{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "#### pdchart 简介\n",
    "pdchart可以快速将你的dataframe、series数据进行可视化，并且图表比pandas原生支持的图表更精美、灵活、强大.\n",
    "\n",
    "pdchart是属于pandas的一款扩展工具，基于pandas、pyecharts基础上开发，要更好的使用pdchart您首先要对这两款工具有一定了解，pdchart的参数配置基本是基于pyecharts封装.\n",
    "\n",
    "[pandas 官网](http://pandas.pydata.org/)\n",
    "\n",
    "[pyecharts 官网](https://pyecharts.org/#/zh-cn/intro)\n",
    "\n",
    "下面简单介绍下我们应该如何使用pdchart.\n",
    "\n",
    "PS: 下面的例子都是在jupyter book上展示."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 13,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>sum</th>\n",
       "      <th>size</th>\n",
       "      <th>year</th>\n",
       "      <th>type</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>100</td>\n",
       "      <td>123</td>\n",
       "      <td>1990</td>\n",
       "      <td>ie</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>380</td>\n",
       "      <td>180</td>\n",
       "      <td>1994</td>\n",
       "      <td>firefox</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>289</td>\n",
       "      <td>250</td>\n",
       "      <td>1998</td>\n",
       "      <td>safari</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>460</td>\n",
       "      <td>90</td>\n",
       "      <td>2000</td>\n",
       "      <td>chrome</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>150</td>\n",
       "      <td>150</td>\n",
       "      <td>2004</td>\n",
       "      <td>edge</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "   sum  size  year     type\n",
       "0  100   123  1990       ie\n",
       "1  380   180  1994  firefox\n",
       "2  289   250  1998   safari\n",
       "3  460    90  2000   chrome\n",
       "4  150   150  2004     edge"
      ]
     },
     "execution_count": 13,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# 引入pdchart、并初始化测试数据集\n",
    "import pandas as pd\n",
    "import pdchart\n",
    "%matplotlib inline\n",
    "\n",
    "df = pd.DataFrame({\n",
    "    'sum': [100, 380, 289, 460, 150],\n",
    "    'size': [123, 180, 250, 90, 150],\n",
    "    'year': [1990, 1994, 1998, 2000, 2004],\n",
    "    'type': ['ie', 'firefox', 'safari', 'chrome', 'edge']\n",
    "})\n",
    "df"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "#### 折线图 - Line"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 14,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<script>\n",
       "    require.config({\n",
       "        paths: {\n",
       "            'echarts':'https://assets.pyecharts.org/assets/echarts.min'\n",
       "        }\n",
       "    });\n",
       "</script>\n",
       "\n",
       "    <div id=\"fdf7cb0e46de4596ae47ccd537136f34\" style=\"width:900px; height:500px;\"></div>\n",
       "\n",
       "\n",
       "<script>\n",
       "    require(['echarts'], function(echarts) {\n",
       "        var chart_fdf7cb0e46de4596ae47ccd537136f34 = echarts.init(\n",
       "            document.getElementById('fdf7cb0e46de4596ae47ccd537136f34'), 'white', {renderer: 'canvas'});\n",
       "        var option_fdf7cb0e46de4596ae47ccd537136f34 = {\n",
       "    \"color\": [\n",
       "        \"#c23531\",\n",
       "        \"#2f4554\",\n",
       "        \"#61a0a8\",\n",
       "        \"#d48265\",\n",
       "        \"#749f83\",\n",
       "        \"#ca8622\",\n",
       "        \"#bda29a\",\n",
       "        \"#6e7074\",\n",
       "        \"#546570\",\n",
       "        \"#c4ccd3\",\n",
       "        \"#f05b72\",\n",
       "        \"#ef5b9c\",\n",
       "        \"#f47920\",\n",
       "        \"#905a3d\",\n",
       "        \"#fab27b\",\n",
       "        \"#2a5caa\",\n",
       "        \"#444693\",\n",
       "        \"#726930\",\n",
       "        \"#b2d235\",\n",
       "        \"#6d8346\",\n",
       "        \"#ac6767\",\n",
       "        \"#1d953f\",\n",
       "        \"#6950a1\",\n",
       "        \"#918597\"\n",
       "    ],\n",
       "    \"series\": [\n",
       "        {\n",
       "            \"type\": \"line\",\n",
       "            \"name\": \"sum\",\n",
       "            \"symbolSize\": 4,\n",
       "            \"showSymbol\": true,\n",
       "            \"smooth\": false,\n",
       "            \"step\": false,\n",
       "            \"data\": [\n",
       "                [\n",
       "                    \"0\",\n",
       "                    100\n",
       "                ],\n",
       "                [\n",
       "                    \"1\",\n",
       "                    380\n",
       "                ],\n",
       "                [\n",
       "                    \"2\",\n",
       "                    289\n",
       "                ],\n",
       "                [\n",
       "                    \"3\",\n",
       "                    460\n",
       "                ],\n",
       "                [\n",
       "                    \"4\",\n",
       "                    150\n",
       "                ]\n",
       "            ],\n",
       "            \"label\": {\n",
       "                \"show\": true,\n",
       "                \"position\": \"top\",\n",
       "                \"margin\": 8,\n",
       "                \"fontSize\": 12\n",
       "            },\n",
       "            \"lineStyle\": {\n",
       "                \"width\": 1,\n",
       "                \"opacity\": 1,\n",
       "                \"curveness\": 0,\n",
       "                \"type\": \"solid\"\n",
       "            },\n",
       "            \"areaStyle\": {\n",
       "                \"opacity\": 0\n",
       "            }\n",
       "        }\n",
       "    ],\n",
       "    \"legend\": [\n",
       "        {\n",
       "            \"data\": [\n",
       "                \"sum\"\n",
       "            ],\n",
       "            \"selected\": {\n",
       "                \"sum\": true\n",
       "            },\n",
       "            \"show\": true\n",
       "        }\n",
       "    ],\n",
       "    \"tooltip\": {\n",
       "        \"show\": true,\n",
       "        \"trigger\": \"item\",\n",
       "        \"triggerOn\": \"mousemove|click\",\n",
       "        \"axisPointer\": {\n",
       "            \"type\": \"line\"\n",
       "        },\n",
       "        \"textStyle\": {\n",
       "            \"fontSize\": 14\n",
       "        },\n",
       "        \"borderWidth\": 0\n",
       "    },\n",
       "    \"yAxis\": [\n",
       "        {\n",
       "            \"show\": true,\n",
       "            \"scale\": false,\n",
       "            \"nameLocation\": \"end\",\n",
       "            \"nameGap\": 15,\n",
       "            \"gridIndex\": 0,\n",
       "            \"inverse\": false,\n",
       "            \"offset\": 0,\n",
       "            \"splitNumber\": 5,\n",
       "            \"minInterval\": 0,\n",
       "            \"splitLine\": {\n",
       "                \"show\": false,\n",
       "                \"lineStyle\": {\n",
       "                    \"width\": 1,\n",
       "                    \"opacity\": 1,\n",
       "                    \"curveness\": 0,\n",
       "                    \"type\": \"solid\"\n",
       "                }\n",
       "            }\n",
       "        }\n",
       "    ],\n",
       "    \"xAxis\": [\n",
       "        {\n",
       "            \"show\": true,\n",
       "            \"scale\": false,\n",
       "            \"nameLocation\": \"end\",\n",
       "            \"nameGap\": 15,\n",
       "            \"gridIndex\": 0,\n",
       "            \"inverse\": false,\n",
       "            \"offset\": 0,\n",
       "            \"splitNumber\": 5,\n",
       "            \"minInterval\": 0,\n",
       "            \"splitLine\": {\n",
       "                \"show\": false,\n",
       "                \"lineStyle\": {\n",
       "                    \"width\": 1,\n",
       "                    \"opacity\": 1,\n",
       "                    \"curveness\": 0,\n",
       "                    \"type\": \"solid\"\n",
       "                }\n",
       "            },\n",
       "            \"data\": [\n",
       "                \"0\",\n",
       "                \"1\",\n",
       "                \"2\",\n",
       "                \"3\",\n",
       "                \"4\"\n",
       "            ]\n",
       "        }\n",
       "    ],\n",
       "    \"title\": {\n",
       "        \"text\": \"Line\"\n",
       "    },\n",
       "    \"toolbox\": {\n",
       "        \"show\": true,\n",
       "        \"orient\": \"horizontal\",\n",
       "        \"itemSize\": 15,\n",
       "        \"itemGap\": 10,\n",
       "        \"left\": \"80%\",\n",
       "        \"feature\": {\n",
       "            \"saveAsImage\": {\n",
       "                \"show\": true,\n",
       "                \"title\": \"save as image\",\n",
       "                \"type\": \"png\"\n",
       "            },\n",
       "            \"restore\": {\n",
       "                \"show\": true,\n",
       "                \"title\": \"restore\"\n",
       "            },\n",
       "            \"dataView\": {\n",
       "                \"show\": true,\n",
       "                \"title\": \"data view\",\n",
       "                \"readOnly\": false\n",
       "            },\n",
       "            \"dataZoom\": {\n",
       "                \"show\": true,\n",
       "                \"title\": {\n",
       "                    \"zoom\": \"data zoom\",\n",
       "                    \"back\": \"data zoom restore\"\n",
       "                }\n",
       "            }\n",
       "        }\n",
       "    }\n",
       "};\n",
       "        chart_fdf7cb0e46de4596ae47ccd537136f34.setOption(option_fdf7cb0e46de4596ae47ccd537136f34);\n",
       "    });\n",
       "</script>\n"
      ],
      "text/plain": [
       "<pyecharts.render.display.HTML at 0x112bd1ba8>"
      ]
     },
     "execution_count": 14,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# 查看sum\n",
    "df['sum'].pdchart.line().render_notebook()\n",
    "\n",
    "# 这是series直接支持plot"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 15,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<script>\n",
       "    require.config({\n",
       "        paths: {\n",
       "            'echarts':'https://assets.pyecharts.org/assets/echarts.min'\n",
       "        }\n",
       "    });\n",
       "</script>\n",
       "\n",
       "    <div id=\"af3b89fce73142af8bcb6d126ad2bf05\" style=\"width:900px; height:500px;\"></div>\n",
       "\n",
       "\n",
       "<script>\n",
       "    require(['echarts'], function(echarts) {\n",
       "        var chart_af3b89fce73142af8bcb6d126ad2bf05 = echarts.init(\n",
       "            document.getElementById('af3b89fce73142af8bcb6d126ad2bf05'), 'white', {renderer: 'canvas'});\n",
       "        var option_af3b89fce73142af8bcb6d126ad2bf05 = {\n",
       "    \"color\": [\n",
       "        \"#c23531\",\n",
       "        \"#2f4554\",\n",
       "        \"#61a0a8\",\n",
       "        \"#d48265\",\n",
       "        \"#749f83\",\n",
       "        \"#ca8622\",\n",
       "        \"#bda29a\",\n",
       "        \"#6e7074\",\n",
       "        \"#546570\",\n",
       "        \"#c4ccd3\",\n",
       "        \"#f05b72\",\n",
       "        \"#ef5b9c\",\n",
       "        \"#f47920\",\n",
       "        \"#905a3d\",\n",
       "        \"#fab27b\",\n",
       "        \"#2a5caa\",\n",
       "        \"#444693\",\n",
       "        \"#726930\",\n",
       "        \"#b2d235\",\n",
       "        \"#6d8346\",\n",
       "        \"#ac6767\",\n",
       "        \"#1d953f\",\n",
       "        \"#6950a1\",\n",
       "        \"#918597\"\n",
       "    ],\n",
       "    \"series\": [\n",
       "        {\n",
       "            \"type\": \"line\",\n",
       "            \"name\": \"sum\",\n",
       "            \"symbolSize\": 4,\n",
       "            \"showSymbol\": true,\n",
       "            \"smooth\": false,\n",
       "            \"step\": false,\n",
       "            \"data\": [\n",
       "                [\n",
       "                    \"ie\",\n",
       "                    100\n",
       "                ],\n",
       "                [\n",
       "                    \"firefox\",\n",
       "                    380\n",
       "                ],\n",
       "                [\n",
       "                    \"safari\",\n",
       "                    289\n",
       "                ],\n",
       "                [\n",
       "                    \"chrome\",\n",
       "                    460\n",
       "                ],\n",
       "                [\n",
       "                    \"edge\",\n",
       "                    150\n",
       "                ]\n",
       "            ],\n",
       "            \"label\": {\n",
       "                \"show\": true,\n",
       "                \"position\": \"top\",\n",
       "                \"margin\": 8,\n",
       "                \"fontSize\": 12\n",
       "            },\n",
       "            \"lineStyle\": {\n",
       "                \"width\": 1,\n",
       "                \"opacity\": 1,\n",
       "                \"curveness\": 0,\n",
       "                \"type\": \"solid\"\n",
       "            },\n",
       "            \"areaStyle\": {\n",
       "                \"opacity\": 0\n",
       "            }\n",
       "        },\n",
       "        {\n",
       "            \"type\": \"line\",\n",
       "            \"name\": \"size\",\n",
       "            \"symbolSize\": 4,\n",
       "            \"showSymbol\": true,\n",
       "            \"smooth\": false,\n",
       "            \"step\": false,\n",
       "            \"data\": [\n",
       "                [\n",
       "                    \"ie\",\n",
       "                    123\n",
       "                ],\n",
       "                [\n",
       "                    \"firefox\",\n",
       "                    180\n",
       "                ],\n",
       "                [\n",
       "                    \"safari\",\n",
       "                    250\n",
       "                ],\n",
       "                [\n",
       "                    \"chrome\",\n",
       "                    90\n",
       "                ],\n",
       "                [\n",
       "                    \"edge\",\n",
       "                    150\n",
       "                ]\n",
       "            ],\n",
       "            \"label\": {\n",
       "                \"show\": true,\n",
       "                \"position\": \"top\",\n",
       "                \"margin\": 8,\n",
       "                \"fontSize\": 12\n",
       "            },\n",
       "            \"lineStyle\": {\n",
       "                \"width\": 1,\n",
       "                \"opacity\": 1,\n",
       "                \"curveness\": 0,\n",
       "                \"type\": \"solid\"\n",
       "            },\n",
       "            \"areaStyle\": {\n",
       "                \"opacity\": 0\n",
       "            }\n",
       "        }\n",
       "    ],\n",
       "    \"legend\": [\n",
       "        {\n",
       "            \"data\": [\n",
       "                \"sum\",\n",
       "                \"size\"\n",
       "            ],\n",
       "            \"selected\": {\n",
       "                \"sum\": true,\n",
       "                \"size\": true\n",
       "            },\n",
       "            \"show\": true\n",
       "        }\n",
       "    ],\n",
       "    \"tooltip\": {\n",
       "        \"show\": true,\n",
       "        \"trigger\": \"item\",\n",
       "        \"triggerOn\": \"mousemove|click\",\n",
       "        \"axisPointer\": {\n",
       "            \"type\": \"line\"\n",
       "        },\n",
       "        \"textStyle\": {\n",
       "            \"fontSize\": 14\n",
       "        },\n",
       "        \"borderWidth\": 0\n",
       "    },\n",
       "    \"yAxis\": [\n",
       "        {\n",
       "            \"show\": true,\n",
       "            \"scale\": false,\n",
       "            \"nameLocation\": \"end\",\n",
       "            \"nameGap\": 15,\n",
       "            \"gridIndex\": 0,\n",
       "            \"inverse\": false,\n",
       "            \"offset\": 0,\n",
       "            \"splitNumber\": 5,\n",
       "            \"minInterval\": 0,\n",
       "            \"splitLine\": {\n",
       "                \"show\": false,\n",
       "                \"lineStyle\": {\n",
       "                    \"width\": 1,\n",
       "                    \"opacity\": 1,\n",
       "                    \"curveness\": 0,\n",
       "                    \"type\": \"solid\"\n",
       "                }\n",
       "            }\n",
       "        }\n",
       "    ],\n",
       "    \"xAxis\": [\n",
       "        {\n",
       "            \"show\": true,\n",
       "            \"scale\": false,\n",
       "            \"nameLocation\": \"end\",\n",
       "            \"nameGap\": 15,\n",
       "            \"gridIndex\": 0,\n",
       "            \"inverse\": false,\n",
       "            \"offset\": 0,\n",
       "            \"splitNumber\": 5,\n",
       "            \"minInterval\": 0,\n",
       "            \"splitLine\": {\n",
       "                \"show\": false,\n",
       "                \"lineStyle\": {\n",
       "                    \"width\": 1,\n",
       "                    \"opacity\": 1,\n",
       "                    \"curveness\": 0,\n",
       "                    \"type\": \"solid\"\n",
       "                }\n",
       "            },\n",
       "            \"data\": [\n",
       "                \"ie\",\n",
       "                \"firefox\",\n",
       "                \"safari\",\n",
       "                \"chrome\",\n",
       "                \"edge\"\n",
       "            ]\n",
       "        }\n",
       "    ],\n",
       "    \"title\": {\n",
       "        \"text\": \"Line\"\n",
       "    },\n",
       "    \"toolbox\": {\n",
       "        \"show\": true,\n",
       "        \"orient\": \"horizontal\",\n",
       "        \"itemSize\": 15,\n",
       "        \"itemGap\": 10,\n",
       "        \"left\": \"80%\",\n",
       "        \"feature\": {\n",
       "            \"saveAsImage\": {\n",
       "                \"show\": true,\n",
       "                \"title\": \"save as image\",\n",
       "                \"type\": \"png\"\n",
       "            },\n",
       "            \"restore\": {\n",
       "                \"show\": true,\n",
       "                \"title\": \"restore\"\n",
       "            },\n",
       "            \"dataView\": {\n",
       "                \"show\": true,\n",
       "                \"title\": \"data view\",\n",
       "                \"readOnly\": false\n",
       "            },\n",
       "            \"dataZoom\": {\n",
       "                \"show\": true,\n",
       "                \"title\": {\n",
       "                    \"zoom\": \"data zoom\",\n",
       "                    \"back\": \"data zoom restore\"\n",
       "                }\n",
       "            }\n",
       "        }\n",
       "    }\n",
       "};\n",
       "        chart_af3b89fce73142af8bcb6d126ad2bf05.setOption(option_af3b89fce73142af8bcb6d126ad2bf05);\n",
       "    });\n",
       "</script>\n"
      ],
      "text/plain": [
       "<pyecharts.render.display.HTML at 0x112b36c50>"
      ]
     },
     "execution_count": 15,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# 您还可以这样，指定x、y轴\n",
    "df.pdchart.line(x='type', y=['sum', 'size']).render_notebook()\n",
    "\n",
    "# 这是dataframe支持plot"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 21,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<script>\n",
       "    require.config({\n",
       "        paths: {\n",
       "            'echarts':'https://assets.pyecharts.org/assets/echarts.min'\n",
       "        }\n",
       "    });\n",
       "</script>\n",
       "\n",
       "    <div id=\"a70da813e9584e0b94e2e7a2a226076e\" style=\"width:900px; height:500px;\"></div>\n",
       "\n",
       "\n",
       "<script>\n",
       "    require(['echarts'], function(echarts) {\n",
       "        var chart_a70da813e9584e0b94e2e7a2a226076e = echarts.init(\n",
       "            document.getElementById('a70da813e9584e0b94e2e7a2a226076e'), 'light', {renderer: 'canvas'});\n",
       "        var option_a70da813e9584e0b94e2e7a2a226076e = {\n",
       "    \"series\": [\n",
       "        {\n",
       "            \"type\": \"line\",\n",
       "            \"name\": \"sum\",\n",
       "            \"symbolSize\": 4,\n",
       "            \"showSymbol\": true,\n",
       "            \"smooth\": true,\n",
       "            \"step\": false,\n",
       "            \"data\": [\n",
       "                [\n",
       "                    \"ie\",\n",
       "                    100\n",
       "                ],\n",
       "                [\n",
       "                    \"firefox\",\n",
       "                    380\n",
       "                ],\n",
       "                [\n",
       "                    \"safari\",\n",
       "                    289\n",
       "                ],\n",
       "                [\n",
       "                    \"chrome\",\n",
       "                    460\n",
       "                ],\n",
       "                [\n",
       "                    \"edge\",\n",
       "                    150\n",
       "                ]\n",
       "            ],\n",
       "            \"label\": {\n",
       "                \"show\": true,\n",
       "                \"position\": \"top\",\n",
       "                \"margin\": 8,\n",
       "                \"fontSize\": 12\n",
       "            },\n",
       "            \"lineStyle\": {\n",
       "                \"width\": 1,\n",
       "                \"opacity\": 1,\n",
       "                \"curveness\": 0,\n",
       "                \"type\": \"solid\"\n",
       "            },\n",
       "            \"areaStyle\": {\n",
       "                \"opacity\": 0\n",
       "            }\n",
       "        },\n",
       "        {\n",
       "            \"type\": \"line\",\n",
       "            \"name\": \"size\",\n",
       "            \"symbolSize\": 4,\n",
       "            \"showSymbol\": true,\n",
       "            \"smooth\": false,\n",
       "            \"step\": true,\n",
       "            \"data\": [\n",
       "                [\n",
       "                    \"ie\",\n",
       "                    123\n",
       "                ],\n",
       "                [\n",
       "                    \"firefox\",\n",
       "                    180\n",
       "                ],\n",
       "                [\n",
       "                    \"safari\",\n",
       "                    250\n",
       "                ],\n",
       "                [\n",
       "                    \"chrome\",\n",
       "                    90\n",
       "                ],\n",
       "                [\n",
       "                    \"edge\",\n",
       "                    150\n",
       "                ]\n",
       "            ],\n",
       "            \"label\": {\n",
       "                \"show\": true,\n",
       "                \"position\": \"top\",\n",
       "                \"margin\": 8,\n",
       "                \"fontSize\": 12\n",
       "            },\n",
       "            \"lineStyle\": {\n",
       "                \"width\": 1,\n",
       "                \"opacity\": 1,\n",
       "                \"curveness\": 0,\n",
       "                \"type\": \"solid\"\n",
       "            },\n",
       "            \"areaStyle\": {\n",
       "                \"opacity\": 0\n",
       "            }\n",
       "        }\n",
       "    ],\n",
       "    \"legend\": [\n",
       "        {\n",
       "            \"data\": [\n",
       "                \"sum\",\n",
       "                \"size\"\n",
       "            ],\n",
       "            \"selected\": {\n",
       "                \"sum\": true,\n",
       "                \"size\": true\n",
       "            },\n",
       "            \"show\": true\n",
       "        }\n",
       "    ],\n",
       "    \"tooltip\": {\n",
       "        \"show\": true,\n",
       "        \"trigger\": \"item\",\n",
       "        \"triggerOn\": \"mousemove|click\",\n",
       "        \"axisPointer\": {\n",
       "            \"type\": \"line\"\n",
       "        },\n",
       "        \"textStyle\": {\n",
       "            \"fontSize\": 14\n",
       "        },\n",
       "        \"borderWidth\": 0\n",
       "    },\n",
       "    \"yAxis\": [\n",
       "        {\n",
       "            \"show\": true,\n",
       "            \"scale\": false,\n",
       "            \"nameLocation\": \"end\",\n",
       "            \"nameGap\": 15,\n",
       "            \"gridIndex\": 0,\n",
       "            \"inverse\": false,\n",
       "            \"offset\": 0,\n",
       "            \"splitNumber\": 5,\n",
       "            \"minInterval\": 0,\n",
       "            \"splitLine\": {\n",
       "                \"show\": false,\n",
       "                \"lineStyle\": {\n",
       "                    \"width\": 1,\n",
       "                    \"opacity\": 1,\n",
       "                    \"curveness\": 0,\n",
       "                    \"type\": \"solid\"\n",
       "                }\n",
       "            }\n",
       "        }\n",
       "    ],\n",
       "    \"xAxis\": [\n",
       "        {\n",
       "            \"show\": true,\n",
       "            \"scale\": false,\n",
       "            \"nameLocation\": \"end\",\n",
       "            \"nameGap\": 15,\n",
       "            \"gridIndex\": 0,\n",
       "            \"inverse\": false,\n",
       "            \"offset\": 0,\n",
       "            \"splitNumber\": 5,\n",
       "            \"minInterval\": 0,\n",
       "            \"splitLine\": {\n",
       "                \"show\": false,\n",
       "                \"lineStyle\": {\n",
       "                    \"width\": 1,\n",
       "                    \"opacity\": 1,\n",
       "                    \"curveness\": 0,\n",
       "                    \"type\": \"solid\"\n",
       "                }\n",
       "            },\n",
       "            \"data\": [\n",
       "                \"ie\",\n",
       "                \"firefox\",\n",
       "                \"safari\",\n",
       "                \"chrome\",\n",
       "                \"edge\"\n",
       "            ]\n",
       "        }\n",
       "    ],\n",
       "    \"title\": {\n",
       "        \"text\": \"Line\"\n",
       "    },\n",
       "    \"toolbox\": {\n",
       "        \"show\": true,\n",
       "        \"orient\": \"horizontal\",\n",
       "        \"itemSize\": 15,\n",
       "        \"itemGap\": 10,\n",
       "        \"left\": \"80%\",\n",
       "        \"feature\": {\n",
       "            \"saveAsImage\": {\n",
       "                \"show\": true,\n",
       "                \"title\": \"save as image\",\n",
       "                \"type\": \"png\"\n",
       "            },\n",
       "            \"restore\": {\n",
       "                \"show\": true,\n",
       "                \"title\": \"restore\"\n",
       "            },\n",
       "            \"dataView\": {\n",
       "                \"show\": true,\n",
       "                \"title\": \"data view\",\n",
       "                \"readOnly\": false\n",
       "            },\n",
       "            \"dataZoom\": {\n",
       "                \"show\": true,\n",
       "                \"title\": {\n",
       "                    \"zoom\": \"data zoom\",\n",
       "                    \"back\": \"data zoom restore\"\n",
       "                }\n",
       "            }\n",
       "        }\n",
       "    }\n",
       "};\n",
       "        chart_a70da813e9584e0b94e2e7a2a226076e.setOption(option_a70da813e9584e0b94e2e7a2a226076e);\n",
       "    });\n",
       "</script>\n"
      ],
      "text/plain": [
       "<pyecharts.render.display.HTML at 0x1160ae048>"
      ]
     },
     "execution_count": 21,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# 支持pyecharts中的图表配置\n",
    "from pyecharts.globals import ThemeType # 引入主题\n",
    "\n",
    "df.pdchart.line(x='type', y=['sum', 'size'], \n",
    "                init_opts={'theme': ThemeType.LIGHT},\n",
    "                y_opts={'sum':{'is_smooth':True}, 'size':{'is_step':True}}).render_notebook()\n",
    "\n",
    "# 更多的配置参数以请参考pyecharts文档"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "#### 柱状图 - Bar"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 23,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<script>\n",
       "    require.config({\n",
       "        paths: {\n",
       "            'echarts':'https://assets.pyecharts.org/assets/echarts.min'\n",
       "        }\n",
       "    });\n",
       "</script>\n",
       "\n",
       "    <div id=\"c337b36f2d244c8bb3ee6e347c1faf4f\" style=\"width:900px; height:500px;\"></div>\n",
       "\n",
       "\n",
       "<script>\n",
       "    require(['echarts'], function(echarts) {\n",
       "        var chart_c337b36f2d244c8bb3ee6e347c1faf4f = echarts.init(\n",
       "            document.getElementById('c337b36f2d244c8bb3ee6e347c1faf4f'), 'white', {renderer: 'canvas'});\n",
       "        var option_c337b36f2d244c8bb3ee6e347c1faf4f = {\n",
       "    \"color\": [\n",
       "        \"#c23531\",\n",
       "        \"#2f4554\",\n",
       "        \"#61a0a8\",\n",
       "        \"#d48265\",\n",
       "        \"#749f83\",\n",
       "        \"#ca8622\",\n",
       "        \"#bda29a\",\n",
       "        \"#6e7074\",\n",
       "        \"#546570\",\n",
       "        \"#c4ccd3\",\n",
       "        \"#f05b72\",\n",
       "        \"#ef5b9c\",\n",
       "        \"#f47920\",\n",
       "        \"#905a3d\",\n",
       "        \"#fab27b\",\n",
       "        \"#2a5caa\",\n",
       "        \"#444693\",\n",
       "        \"#726930\",\n",
       "        \"#b2d235\",\n",
       "        \"#6d8346\",\n",
       "        \"#ac6767\",\n",
       "        \"#1d953f\",\n",
       "        \"#6950a1\",\n",
       "        \"#918597\"\n",
       "    ],\n",
       "    \"series\": [\n",
       "        {\n",
       "            \"type\": \"bar\",\n",
       "            \"name\": \"sum\",\n",
       "            \"data\": [\n",
       "                100,\n",
       "                380,\n",
       "                289,\n",
       "                460,\n",
       "                150\n",
       "            ],\n",
       "            \"barCategoryGap\": \"20%\",\n",
       "            \"label\": {\n",
       "                \"show\": true,\n",
       "                \"position\": \"top\",\n",
       "                \"margin\": 8,\n",
       "                \"fontSize\": 12\n",
       "            }\n",
       "        },\n",
       "        {\n",
       "            \"type\": \"bar\",\n",
       "            \"name\": \"size\",\n",
       "            \"data\": [\n",
       "                123,\n",
       "                180,\n",
       "                250,\n",
       "                90,\n",
       "                150\n",
       "            ],\n",
       "            \"barCategoryGap\": \"20%\",\n",
       "            \"label\": {\n",
       "                \"show\": true,\n",
       "                \"position\": \"top\",\n",
       "                \"margin\": 8,\n",
       "                \"fontSize\": 12\n",
       "            }\n",
       "        }\n",
       "    ],\n",
       "    \"legend\": [\n",
       "        {\n",
       "            \"data\": [\n",
       "                \"sum\",\n",
       "                \"size\"\n",
       "            ],\n",
       "            \"selected\": {\n",
       "                \"sum\": true,\n",
       "                \"size\": true\n",
       "            },\n",
       "            \"show\": true\n",
       "        }\n",
       "    ],\n",
       "    \"tooltip\": {\n",
       "        \"show\": true,\n",
       "        \"trigger\": \"item\",\n",
       "        \"triggerOn\": \"mousemove|click\",\n",
       "        \"axisPointer\": {\n",
       "            \"type\": \"line\"\n",
       "        },\n",
       "        \"textStyle\": {\n",
       "            \"fontSize\": 14\n",
       "        },\n",
       "        \"borderWidth\": 0\n",
       "    },\n",
       "    \"yAxis\": [\n",
       "        {\n",
       "            \"show\": true,\n",
       "            \"scale\": false,\n",
       "            \"nameLocation\": \"end\",\n",
       "            \"nameGap\": 15,\n",
       "            \"gridIndex\": 0,\n",
       "            \"inverse\": false,\n",
       "            \"offset\": 0,\n",
       "            \"splitNumber\": 5,\n",
       "            \"minInterval\": 0,\n",
       "            \"splitLine\": {\n",
       "                \"show\": false,\n",
       "                \"lineStyle\": {\n",
       "                    \"width\": 1,\n",
       "                    \"opacity\": 1,\n",
       "                    \"curveness\": 0,\n",
       "                    \"type\": \"solid\"\n",
       "                }\n",
       "            }\n",
       "        }\n",
       "    ],\n",
       "    \"xAxis\": [\n",
       "        {\n",
       "            \"show\": true,\n",
       "            \"scale\": false,\n",
       "            \"nameLocation\": \"end\",\n",
       "            \"nameGap\": 15,\n",
       "            \"gridIndex\": 0,\n",
       "            \"inverse\": false,\n",
       "            \"offset\": 0,\n",
       "            \"splitNumber\": 5,\n",
       "            \"minInterval\": 0,\n",
       "            \"splitLine\": {\n",
       "                \"show\": false,\n",
       "                \"lineStyle\": {\n",
       "                    \"width\": 1,\n",
       "                    \"opacity\": 1,\n",
       "                    \"curveness\": 0,\n",
       "                    \"type\": \"solid\"\n",
       "                }\n",
       "            },\n",
       "            \"data\": [\n",
       "                1990,\n",
       "                1994,\n",
       "                1998,\n",
       "                2000,\n",
       "                2004\n",
       "            ]\n",
       "        }\n",
       "    ],\n",
       "    \"title\": {\n",
       "        \"text\": \"Bar\"\n",
       "    },\n",
       "    \"toolbox\": {\n",
       "        \"show\": true,\n",
       "        \"orient\": \"horizontal\",\n",
       "        \"itemSize\": 15,\n",
       "        \"itemGap\": 10,\n",
       "        \"left\": \"80%\",\n",
       "        \"feature\": {\n",
       "            \"saveAsImage\": {\n",
       "                \"show\": true,\n",
       "                \"title\": \"save as image\",\n",
       "                \"type\": \"png\"\n",
       "            },\n",
       "            \"restore\": {\n",
       "                \"show\": true,\n",
       "                \"title\": \"restore\"\n",
       "            },\n",
       "            \"dataView\": {\n",
       "                \"show\": true,\n",
       "                \"title\": \"data view\",\n",
       "                \"readOnly\": false\n",
       "            },\n",
       "            \"dataZoom\": {\n",
       "                \"show\": true,\n",
       "                \"title\": {\n",
       "                    \"zoom\": \"data zoom\",\n",
       "                    \"back\": \"data zoom restore\"\n",
       "                }\n",
       "            }\n",
       "        }\n",
       "    }\n",
       "};\n",
       "        chart_c337b36f2d244c8bb3ee6e347c1faf4f.setOption(option_c337b36f2d244c8bb3ee6e347c1faf4f);\n",
       "    });\n",
       "</script>\n"
      ],
      "text/plain": [
       "<pyecharts.render.display.HTML at 0x116303860>"
      ]
     },
     "execution_count": 23,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df.pdchart.bar(x='year', y=['sum', 'size']).render_notebook()"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "#### 散点图 - Scatter"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 30,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<script>\n",
       "    require.config({\n",
       "        paths: {\n",
       "            'echarts':'https://assets.pyecharts.org/assets/echarts.min'\n",
       "        }\n",
       "    });\n",
       "</script>\n",
       "\n",
       "    <div id=\"5c17caf7215a48e2b220e9f6c94e78f0\" style=\"width:900px; height:500px;\"></div>\n",
       "\n",
       "\n",
       "<script>\n",
       "    require(['echarts'], function(echarts) {\n",
       "        var chart_5c17caf7215a48e2b220e9f6c94e78f0 = echarts.init(\n",
       "            document.getElementById('5c17caf7215a48e2b220e9f6c94e78f0'), 'white', {renderer: 'canvas'});\n",
       "        var option_5c17caf7215a48e2b220e9f6c94e78f0 = {\n",
       "    \"color\": [\n",
       "        \"#c23531\",\n",
       "        \"#2f4554\",\n",
       "        \"#61a0a8\",\n",
       "        \"#d48265\",\n",
       "        \"#749f83\",\n",
       "        \"#ca8622\",\n",
       "        \"#bda29a\",\n",
       "        \"#6e7074\",\n",
       "        \"#546570\",\n",
       "        \"#c4ccd3\",\n",
       "        \"#f05b72\",\n",
       "        \"#ef5b9c\",\n",
       "        \"#f47920\",\n",
       "        \"#905a3d\",\n",
       "        \"#fab27b\",\n",
       "        \"#2a5caa\",\n",
       "        \"#444693\",\n",
       "        \"#726930\",\n",
       "        \"#b2d235\",\n",
       "        \"#6d8346\",\n",
       "        \"#ac6767\",\n",
       "        \"#1d953f\",\n",
       "        \"#6950a1\",\n",
       "        \"#918597\"\n",
       "    ],\n",
       "    \"series\": [\n",
       "        {\n",
       "            \"type\": \"scatter\",\n",
       "            \"name\": \"sum\",\n",
       "            \"symbolSize\": 10,\n",
       "            \"data\": [\n",
       "                [\n",
       "                    \"ie\",\n",
       "                    100\n",
       "                ],\n",
       "                [\n",
       "                    \"firefox\",\n",
       "                    380\n",
       "                ],\n",
       "                [\n",
       "                    \"safari\",\n",
       "                    289\n",
       "                ],\n",
       "                [\n",
       "                    \"chrome\",\n",
       "                    460\n",
       "                ],\n",
       "                [\n",
       "                    \"edge\",\n",
       "                    150\n",
       "                ]\n",
       "            ],\n",
       "            \"label\": {\n",
       "                \"show\": true,\n",
       "                \"position\": \"right\",\n",
       "                \"margin\": 8,\n",
       "                \"fontSize\": 12\n",
       "            }\n",
       "        },\n",
       "        {\n",
       "            \"type\": \"scatter\",\n",
       "            \"name\": \"size\",\n",
       "            \"symbolSize\": 10,\n",
       "            \"data\": [\n",
       "                [\n",
       "                    \"ie\",\n",
       "                    123\n",
       "                ],\n",
       "                [\n",
       "                    \"firefox\",\n",
       "                    180\n",
       "                ],\n",
       "                [\n",
       "                    \"safari\",\n",
       "                    250\n",
       "                ],\n",
       "                [\n",
       "                    \"chrome\",\n",
       "                    90\n",
       "                ],\n",
       "                [\n",
       "                    \"edge\",\n",
       "                    150\n",
       "                ]\n",
       "            ],\n",
       "            \"label\": {\n",
       "                \"show\": true,\n",
       "                \"position\": \"right\",\n",
       "                \"margin\": 8,\n",
       "                \"fontSize\": 12\n",
       "            }\n",
       "        }\n",
       "    ],\n",
       "    \"legend\": [\n",
       "        {\n",
       "            \"data\": [\n",
       "                \"sum\",\n",
       "                \"size\"\n",
       "            ],\n",
       "            \"selected\": {\n",
       "                \"sum\": true,\n",
       "                \"size\": true\n",
       "            },\n",
       "            \"show\": true\n",
       "        }\n",
       "    ],\n",
       "    \"tooltip\": {\n",
       "        \"show\": true,\n",
       "        \"trigger\": \"item\",\n",
       "        \"triggerOn\": \"mousemove|click\",\n",
       "        \"axisPointer\": {\n",
       "            \"type\": \"line\"\n",
       "        },\n",
       "        \"textStyle\": {\n",
       "            \"fontSize\": 14\n",
       "        },\n",
       "        \"borderWidth\": 0\n",
       "    },\n",
       "    \"yAxis\": [\n",
       "        {\n",
       "            \"show\": true,\n",
       "            \"scale\": false,\n",
       "            \"nameLocation\": \"end\",\n",
       "            \"nameGap\": 15,\n",
       "            \"gridIndex\": 0,\n",
       "            \"inverse\": false,\n",
       "            \"offset\": 0,\n",
       "            \"splitNumber\": 5,\n",
       "            \"minInterval\": 0,\n",
       "            \"splitLine\": {\n",
       "                \"show\": false,\n",
       "                \"lineStyle\": {\n",
       "                    \"width\": 1,\n",
       "                    \"opacity\": 1,\n",
       "                    \"curveness\": 0,\n",
       "                    \"type\": \"solid\"\n",
       "                }\n",
       "            }\n",
       "        }\n",
       "    ],\n",
       "    \"xAxis\": [\n",
       "        {\n",
       "            \"show\": true,\n",
       "            \"scale\": false,\n",
       "            \"nameLocation\": \"end\",\n",
       "            \"nameGap\": 15,\n",
       "            \"gridIndex\": 0,\n",
       "            \"inverse\": false,\n",
       "            \"offset\": 0,\n",
       "            \"splitNumber\": 5,\n",
       "            \"minInterval\": 0,\n",
       "            \"splitLine\": {\n",
       "                \"show\": false,\n",
       "                \"lineStyle\": {\n",
       "                    \"width\": 1,\n",
       "                    \"opacity\": 1,\n",
       "                    \"curveness\": 0,\n",
       "                    \"type\": \"solid\"\n",
       "                }\n",
       "            },\n",
       "            \"data\": [\n",
       "                \"ie\",\n",
       "                \"firefox\",\n",
       "                \"safari\",\n",
       "                \"chrome\",\n",
       "                \"edge\"\n",
       "            ]\n",
       "        }\n",
       "    ],\n",
       "    \"title\": {\n",
       "        \"text\": \"Scatter\"\n",
       "    },\n",
       "    \"toolbox\": {\n",
       "        \"show\": true,\n",
       "        \"orient\": \"horizontal\",\n",
       "        \"itemSize\": 15,\n",
       "        \"itemGap\": 10,\n",
       "        \"left\": \"80%\",\n",
       "        \"feature\": {\n",
       "            \"saveAsImage\": {\n",
       "                \"show\": true,\n",
       "                \"title\": \"save as image\",\n",
       "                \"type\": \"png\"\n",
       "            },\n",
       "            \"restore\": {\n",
       "                \"show\": true,\n",
       "                \"title\": \"restore\"\n",
       "            },\n",
       "            \"dataView\": {\n",
       "                \"show\": true,\n",
       "                \"title\": \"data view\",\n",
       "                \"readOnly\": false\n",
       "            },\n",
       "            \"dataZoom\": {\n",
       "                \"show\": true,\n",
       "                \"title\": {\n",
       "                    \"zoom\": \"data zoom\",\n",
       "                    \"back\": \"data zoom restore\"\n",
       "                }\n",
       "            }\n",
       "        }\n",
       "    }\n",
       "};\n",
       "        chart_5c17caf7215a48e2b220e9f6c94e78f0.setOption(option_5c17caf7215a48e2b220e9f6c94e78f0);\n",
       "    });\n",
       "</script>\n"
      ],
      "text/plain": [
       "<pyecharts.render.display.HTML at 0x115e96d68>"
      ]
     },
     "execution_count": 30,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df.pdchart.scatter(x='type', y=['sum', 'size']).render_notebook()"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "#### 涟漪散点图 - effectScatter"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 31,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<script>\n",
       "    require.config({\n",
       "        paths: {\n",
       "            'echarts':'https://assets.pyecharts.org/assets/echarts.min'\n",
       "        }\n",
       "    });\n",
       "</script>\n",
       "\n",
       "    <div id=\"55d902c189724be099e0f075da76db42\" style=\"width:900px; height:500px;\"></div>\n",
       "\n",
       "\n",
       "<script>\n",
       "    require(['echarts'], function(echarts) {\n",
       "        var chart_55d902c189724be099e0f075da76db42 = echarts.init(\n",
       "            document.getElementById('55d902c189724be099e0f075da76db42'), 'white', {renderer: 'canvas'});\n",
       "        var option_55d902c189724be099e0f075da76db42 = {\n",
       "    \"color\": [\n",
       "        \"#c23531\",\n",
       "        \"#2f4554\",\n",
       "        \"#61a0a8\",\n",
       "        \"#d48265\",\n",
       "        \"#749f83\",\n",
       "        \"#ca8622\",\n",
       "        \"#bda29a\",\n",
       "        \"#6e7074\",\n",
       "        \"#546570\",\n",
       "        \"#c4ccd3\",\n",
       "        \"#f05b72\",\n",
       "        \"#ef5b9c\",\n",
       "        \"#f47920\",\n",
       "        \"#905a3d\",\n",
       "        \"#fab27b\",\n",
       "        \"#2a5caa\",\n",
       "        \"#444693\",\n",
       "        \"#726930\",\n",
       "        \"#b2d235\",\n",
       "        \"#6d8346\",\n",
       "        \"#ac6767\",\n",
       "        \"#1d953f\",\n",
       "        \"#6950a1\",\n",
       "        \"#918597\"\n",
       "    ],\n",
       "    \"series\": [\n",
       "        {\n",
       "            \"type\": \"effectScatter\",\n",
       "            \"name\": \"sum\",\n",
       "            \"showEffectOn\": \"render\",\n",
       "            \"rippleEffect\": {\n",
       "                \"show\": true,\n",
       "                \"brushType\": \"stroke\",\n",
       "                \"scale\": 2.5,\n",
       "                \"period\": 4\n",
       "            },\n",
       "            \"symbolSize\": 10,\n",
       "            \"data\": [\n",
       "                [\n",
       "                    \"ie\",\n",
       "                    100\n",
       "                ],\n",
       "                [\n",
       "                    \"firefox\",\n",
       "                    380\n",
       "                ],\n",
       "                [\n",
       "                    \"safari\",\n",
       "                    289\n",
       "                ],\n",
       "                [\n",
       "                    \"chrome\",\n",
       "                    460\n",
       "                ],\n",
       "                [\n",
       "                    \"edge\",\n",
       "                    150\n",
       "                ]\n",
       "            ],\n",
       "            \"label\": {\n",
       "                \"show\": true,\n",
       "                \"position\": \"top\",\n",
       "                \"margin\": 8,\n",
       "                \"fontSize\": 12\n",
       "            }\n",
       "        },\n",
       "        {\n",
       "            \"type\": \"effectScatter\",\n",
       "            \"name\": \"size\",\n",
       "            \"showEffectOn\": \"render\",\n",
       "            \"rippleEffect\": {\n",
       "                \"show\": true,\n",
       "                \"brushType\": \"stroke\",\n",
       "                \"scale\": 2.5,\n",
       "                \"period\": 4\n",
       "            },\n",
       "            \"symbolSize\": 10,\n",
       "            \"data\": [\n",
       "                [\n",
       "                    \"ie\",\n",
       "                    123\n",
       "                ],\n",
       "                [\n",
       "                    \"firefox\",\n",
       "                    180\n",
       "                ],\n",
       "                [\n",
       "                    \"safari\",\n",
       "                    250\n",
       "                ],\n",
       "                [\n",
       "                    \"chrome\",\n",
       "                    90\n",
       "                ],\n",
       "                [\n",
       "                    \"edge\",\n",
       "                    150\n",
       "                ]\n",
       "            ],\n",
       "            \"label\": {\n",
       "                \"show\": true,\n",
       "                \"position\": \"top\",\n",
       "                \"margin\": 8,\n",
       "                \"fontSize\": 12\n",
       "            }\n",
       "        }\n",
       "    ],\n",
       "    \"legend\": [\n",
       "        {\n",
       "            \"data\": [\n",
       "                \"sum\",\n",
       "                \"size\"\n",
       "            ],\n",
       "            \"selected\": {\n",
       "                \"sum\": true,\n",
       "                \"size\": true\n",
       "            },\n",
       "            \"show\": true\n",
       "        }\n",
       "    ],\n",
       "    \"tooltip\": {\n",
       "        \"show\": true,\n",
       "        \"trigger\": \"item\",\n",
       "        \"triggerOn\": \"mousemove|click\",\n",
       "        \"axisPointer\": {\n",
       "            \"type\": \"line\"\n",
       "        },\n",
       "        \"textStyle\": {\n",
       "            \"fontSize\": 14\n",
       "        },\n",
       "        \"borderWidth\": 0\n",
       "    },\n",
       "    \"yAxis\": [\n",
       "        {\n",
       "            \"show\": true,\n",
       "            \"scale\": false,\n",
       "            \"nameLocation\": \"end\",\n",
       "            \"nameGap\": 15,\n",
       "            \"gridIndex\": 0,\n",
       "            \"inverse\": false,\n",
       "            \"offset\": 0,\n",
       "            \"splitNumber\": 5,\n",
       "            \"minInterval\": 0,\n",
       "            \"splitLine\": {\n",
       "                \"show\": false,\n",
       "                \"lineStyle\": {\n",
       "                    \"width\": 1,\n",
       "                    \"opacity\": 1,\n",
       "                    \"curveness\": 0,\n",
       "                    \"type\": \"solid\"\n",
       "                }\n",
       "            }\n",
       "        }\n",
       "    ],\n",
       "    \"xAxis\": [\n",
       "        {\n",
       "            \"show\": true,\n",
       "            \"scale\": false,\n",
       "            \"nameLocation\": \"end\",\n",
       "            \"nameGap\": 15,\n",
       "            \"gridIndex\": 0,\n",
       "            \"inverse\": false,\n",
       "            \"offset\": 0,\n",
       "            \"splitNumber\": 5,\n",
       "            \"minInterval\": 0,\n",
       "            \"splitLine\": {\n",
       "                \"show\": false,\n",
       "                \"lineStyle\": {\n",
       "                    \"width\": 1,\n",
       "                    \"opacity\": 1,\n",
       "                    \"curveness\": 0,\n",
       "                    \"type\": \"solid\"\n",
       "                }\n",
       "            },\n",
       "            \"data\": [\n",
       "                \"ie\",\n",
       "                \"firefox\",\n",
       "                \"safari\",\n",
       "                \"chrome\",\n",
       "                \"edge\"\n",
       "            ]\n",
       "        }\n",
       "    ],\n",
       "    \"title\": {\n",
       "        \"text\": \"Effectscatter\"\n",
       "    },\n",
       "    \"toolbox\": {\n",
       "        \"show\": true,\n",
       "        \"orient\": \"horizontal\",\n",
       "        \"itemSize\": 15,\n",
       "        \"itemGap\": 10,\n",
       "        \"left\": \"80%\",\n",
       "        \"feature\": {\n",
       "            \"saveAsImage\": {\n",
       "                \"show\": true,\n",
       "                \"title\": \"save as image\",\n",
       "                \"type\": \"png\"\n",
       "            },\n",
       "            \"restore\": {\n",
       "                \"show\": true,\n",
       "                \"title\": \"restore\"\n",
       "            },\n",
       "            \"dataView\": {\n",
       "                \"show\": true,\n",
       "                \"title\": \"data view\",\n",
       "                \"readOnly\": false\n",
       "            },\n",
       "            \"dataZoom\": {\n",
       "                \"show\": true,\n",
       "                \"title\": {\n",
       "                    \"zoom\": \"data zoom\",\n",
       "                    \"back\": \"data zoom restore\"\n",
       "                }\n",
       "            }\n",
       "        }\n",
       "    }\n",
       "};\n",
       "        chart_55d902c189724be099e0f075da76db42.setOption(option_55d902c189724be099e0f075da76db42);\n",
       "    });\n",
       "</script>\n"
      ],
      "text/plain": [
       "<pyecharts.render.display.HTML at 0x116303e48>"
      ]
     },
     "execution_count": 31,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df.pdchart.scatter(x='type', y=['sum', 'size'], effect=True).render_notebook()"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "#### 饼图 - Pie"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 36,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<script>\n",
       "    require.config({\n",
       "        paths: {\n",
       "            'echarts':'https://assets.pyecharts.org/assets/echarts.min'\n",
       "        }\n",
       "    });\n",
       "</script>\n",
       "\n",
       "    <div id=\"8955e7425e584d20a6b7b45ee330e472\" style=\"width:900px; height:500px;\"></div>\n",
       "\n",
       "\n",
       "<script>\n",
       "    require(['echarts'], function(echarts) {\n",
       "        var chart_8955e7425e584d20a6b7b45ee330e472 = echarts.init(\n",
       "            document.getElementById('8955e7425e584d20a6b7b45ee330e472'), 'white', {renderer: 'canvas'});\n",
       "        var option_8955e7425e584d20a6b7b45ee330e472 = {\n",
       "    \"color\": [\n",
       "        \"#c23531\",\n",
       "        \"#2f4554\",\n",
       "        \"#61a0a8\",\n",
       "        \"#d48265\",\n",
       "        \"#749f83\",\n",
       "        \"#ca8622\",\n",
       "        \"#bda29a\",\n",
       "        \"#6e7074\",\n",
       "        \"#546570\",\n",
       "        \"#c4ccd3\",\n",
       "        \"#f05b72\",\n",
       "        \"#ef5b9c\",\n",
       "        \"#f47920\",\n",
       "        \"#905a3d\",\n",
       "        \"#fab27b\",\n",
       "        \"#2a5caa\",\n",
       "        \"#444693\",\n",
       "        \"#726930\",\n",
       "        \"#b2d235\",\n",
       "        \"#6d8346\",\n",
       "        \"#ac6767\",\n",
       "        \"#1d953f\",\n",
       "        \"#6950a1\",\n",
       "        \"#918597\"\n",
       "    ],\n",
       "    \"series\": [\n",
       "        {\n",
       "            \"type\": \"pie\",\n",
       "            \"clockwise\": true,\n",
       "            \"data\": [\n",
       "                {\n",
       "                    \"name\": \"ie\",\n",
       "                    \"value\": 100\n",
       "                },\n",
       "                {\n",
       "                    \"name\": \"firefox\",\n",
       "                    \"value\": 380\n",
       "                },\n",
       "                {\n",
       "                    \"name\": \"safari\",\n",
       "                    \"value\": 289\n",
       "                },\n",
       "                {\n",
       "                    \"name\": \"chrome\",\n",
       "                    \"value\": 460\n",
       "                },\n",
       "                {\n",
       "                    \"name\": \"edge\",\n",
       "                    \"value\": 150\n",
       "                }\n",
       "            ],\n",
       "            \"radius\": [\n",
       "                \"0%\",\n",
       "                \"75%\"\n",
       "            ],\n",
       "            \"center\": [\n",
       "                \"50%\",\n",
       "                \"50%\"\n",
       "            ],\n",
       "            \"label\": {\n",
       "                \"show\": true,\n",
       "                \"position\": \"top\",\n",
       "                \"margin\": 8,\n",
       "                \"fontSize\": 12\n",
       "            }\n",
       "        }\n",
       "    ],\n",
       "    \"legend\": [\n",
       "        {\n",
       "            \"data\": [\n",
       "                \"ie\",\n",
       "                \"firefox\",\n",
       "                \"safari\",\n",
       "                \"chrome\",\n",
       "                \"edge\"\n",
       "            ],\n",
       "            \"selected\": {},\n",
       "            \"show\": true\n",
       "        }\n",
       "    ],\n",
       "    \"tooltip\": {\n",
       "        \"show\": true,\n",
       "        \"trigger\": \"item\",\n",
       "        \"triggerOn\": \"mousemove|click\",\n",
       "        \"axisPointer\": {\n",
       "            \"type\": \"line\"\n",
       "        },\n",
       "        \"textStyle\": {\n",
       "            \"fontSize\": 14\n",
       "        },\n",
       "        \"borderWidth\": 0\n",
       "    },\n",
       "    \"title\": {\n",
       "        \"text\": \"Pie\"\n",
       "    },\n",
       "    \"toolbox\": {\n",
       "        \"show\": true,\n",
       "        \"orient\": \"horizontal\",\n",
       "        \"itemSize\": 15,\n",
       "        \"itemGap\": 10,\n",
       "        \"left\": \"80%\",\n",
       "        \"feature\": {\n",
       "            \"saveAsImage\": {\n",
       "                \"show\": true,\n",
       "                \"title\": \"save as image\",\n",
       "                \"type\": \"png\"\n",
       "            },\n",
       "            \"restore\": {\n",
       "                \"show\": true,\n",
       "                \"title\": \"restore\"\n",
       "            },\n",
       "            \"dataView\": {\n",
       "                \"show\": true,\n",
       "                \"title\": \"data view\",\n",
       "                \"readOnly\": false\n",
       "            },\n",
       "            \"dataZoom\": {\n",
       "                \"show\": true,\n",
       "                \"title\": {\n",
       "                    \"zoom\": \"data zoom\",\n",
       "                    \"back\": \"data zoom restore\"\n",
       "                }\n",
       "            }\n",
       "        }\n",
       "    }\n",
       "};\n",
       "        chart_8955e7425e584d20a6b7b45ee330e472.setOption(option_8955e7425e584d20a6b7b45ee330e472);\n",
       "    });\n",
       "</script>\n"
      ],
      "text/plain": [
       "<pyecharts.render.display.HTML at 0x116839278>"
      ]
     },
     "execution_count": 36,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df.set_index('type')['sum'].pdchart.pie().render_notebook()"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "#### 词云图 - wordCloud"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 40,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>name</th>\n",
       "      <th>num</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>Sam S Club</td>\n",
       "      <td>10000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>Macys</td>\n",
       "      <td>6181</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>Amy Schumer</td>\n",
       "      <td>4386</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>Jurassic World</td>\n",
       "      <td>4055</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>Charter Communications</td>\n",
       "      <td>2467</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "                     name    num\n",
       "0              Sam S Club  10000\n",
       "1                   Macys   6181\n",
       "2             Amy Schumer   4386\n",
       "3          Jurassic World   4055\n",
       "4  Charter Communications   2467"
      ]
     },
     "execution_count": 40,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# 上面的测试数据太少，初始化新数据\n",
    "words = [\n",
    "    (\"Sam S Club\", 10000),\n",
    "    (\"Macys\", 6181),\n",
    "    (\"Amy Schumer\", 4386),\n",
    "    (\"Jurassic World\", 4055),\n",
    "    (\"Charter Communications\", 2467),\n",
    "    (\"Chick Fil A\", 2244),\n",
    "    (\"Planet Fitness\", 1868),\n",
    "    (\"Pitch Perfect\", 1484),\n",
    "    (\"Express\", 1112),\n",
    "    (\"Home\", 865),\n",
    "    (\"Johnny Depp\", 847),\n",
    "    (\"Lena Dunham\", 582),\n",
    "    (\"Lewis Hamilton\", 555),\n",
    "    (\"KXAN\", 550),\n",
    "    (\"Mary Ellen Mark\", 462),\n",
    "    (\"Farrah Abraham\", 366),\n",
    "    (\"Rita Ora\", 360),\n",
    "    (\"Serena Williams\", 282),\n",
    "    (\"NCAA baseball tournament\", 273),\n",
    "    (\"Point Break\", 265),\n",
    "]\n",
    "\n",
    "new_df = pd.DataFrame(words, columns=['name', 'num'])\n",
    "new_df.head(5)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 39,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<script>\n",
       "    require.config({\n",
       "        paths: {\n",
       "            'echarts':'https://assets.pyecharts.org/assets/echarts.min', 'echarts-wordcloud':'https://assets.pyecharts.org/assets/echarts-wordcloud.min'\n",
       "        }\n",
       "    });\n",
       "</script>\n",
       "\n",
       "    <div id=\"0cfcb3ee33454c8c96eea416c62c89a4\" style=\"width:900px; height:500px;\"></div>\n",
       "\n",
       "\n",
       "<script>\n",
       "    require(['echarts', 'echarts-wordcloud'], function(echarts) {\n",
       "        var chart_0cfcb3ee33454c8c96eea416c62c89a4 = echarts.init(\n",
       "            document.getElementById('0cfcb3ee33454c8c96eea416c62c89a4'), 'white', {renderer: 'canvas'});\n",
       "        var option_0cfcb3ee33454c8c96eea416c62c89a4 = {\n",
       "    \"color\": [\n",
       "        \"#c23531\",\n",
       "        \"#2f4554\",\n",
       "        \"#61a0a8\",\n",
       "        \"#d48265\",\n",
       "        \"#749f83\",\n",
       "        \"#ca8622\",\n",
       "        \"#bda29a\",\n",
       "        \"#6e7074\",\n",
       "        \"#546570\",\n",
       "        \"#c4ccd3\",\n",
       "        \"#f05b72\",\n",
       "        \"#ef5b9c\",\n",
       "        \"#f47920\",\n",
       "        \"#905a3d\",\n",
       "        \"#fab27b\",\n",
       "        \"#2a5caa\",\n",
       "        \"#444693\",\n",
       "        \"#726930\",\n",
       "        \"#b2d235\",\n",
       "        \"#6d8346\",\n",
       "        \"#ac6767\",\n",
       "        \"#1d953f\",\n",
       "        \"#6950a1\",\n",
       "        \"#918597\"\n",
       "    ],\n",
       "    \"series\": [\n",
       "        {\n",
       "            \"type\": \"wordCloud\",\n",
       "            \"shape\": \"circle\",\n",
       "            \"rotationRange\": [\n",
       "                -90,\n",
       "                90\n",
       "            ],\n",
       "            \"rotationStep\": 45,\n",
       "            \"girdSize\": 20,\n",
       "            \"sizeRange\": [\n",
       "                12,\n",
       "                60\n",
       "            ],\n",
       "            \"data\": [\n",
       "                {\n",
       "                    \"name\": \"Sam S Club\",\n",
       "                    \"value\": 10000,\n",
       "                    \"textStyle\": {\n",
       "                        \"normal\": {\n",
       "                            \"color\": \"rgb(36,148,118)\"\n",
       "                        }\n",
       "                    }\n",
       "                },\n",
       "                {\n",
       "                    \"name\": \"Macys\",\n",
       "                    \"value\": 6181,\n",
       "                    \"textStyle\": {\n",
       "                        \"normal\": {\n",
       "                            \"color\": \"rgb(1,73,128)\"\n",
       "                        }\n",
       "                    }\n",
       "                },\n",
       "                {\n",
       "                    \"name\": \"Amy Schumer\",\n",
       "                    \"value\": 4386,\n",
       "                    \"textStyle\": {\n",
       "                        \"normal\": {\n",
       "                            \"color\": \"rgb(124,119,57)\"\n",
       "                        }\n",
       "                    }\n",
       "                },\n",
       "                {\n",
       "                    \"name\": \"Jurassic World\",\n",
       "                    \"value\": 4055,\n",
       "                    \"textStyle\": {\n",
       "                        \"normal\": {\n",
       "                            \"color\": \"rgb(158,97,65)\"\n",
       "                        }\n",
       "                    }\n",
       "                },\n",
       "                {\n",
       "                    \"name\": \"Charter Communications\",\n",
       "                    \"value\": 2467,\n",
       "                    \"textStyle\": {\n",
       "                        \"normal\": {\n",
       "                            \"color\": \"rgb(71,23,154)\"\n",
       "                        }\n",
       "                    }\n",
       "                },\n",
       "                {\n",
       "                    \"name\": \"Chick Fil A\",\n",
       "                    \"value\": 2244,\n",
       "                    \"textStyle\": {\n",
       "                        \"normal\": {\n",
       "                            \"color\": \"rgb(123,110,96)\"\n",
       "                        }\n",
       "                    }\n",
       "                },\n",
       "                {\n",
       "                    \"name\": \"Planet Fitness\",\n",
       "                    \"value\": 1868,\n",
       "                    \"textStyle\": {\n",
       "                        \"normal\": {\n",
       "                            \"color\": \"rgb(136,41,64)\"\n",
       "                        }\n",
       "                    }\n",
       "                },\n",
       "                {\n",
       "                    \"name\": \"Pitch Perfect\",\n",
       "                    \"value\": 1484,\n",
       "                    \"textStyle\": {\n",
       "                        \"normal\": {\n",
       "                            \"color\": \"rgb(97,58,140)\"\n",
       "                        }\n",
       "                    }\n",
       "                },\n",
       "                {\n",
       "                    \"name\": \"Express\",\n",
       "                    \"value\": 1112,\n",
       "                    \"textStyle\": {\n",
       "                        \"normal\": {\n",
       "                            \"color\": \"rgb(16,65,136)\"\n",
       "                        }\n",
       "                    }\n",
       "                },\n",
       "                {\n",
       "                    \"name\": \"Home\",\n",
       "                    \"value\": 865,\n",
       "                    \"textStyle\": {\n",
       "                        \"normal\": {\n",
       "                            \"color\": \"rgb(122,88,84)\"\n",
       "                        }\n",
       "                    }\n",
       "                },\n",
       "                {\n",
       "                    \"name\": \"Johnny Depp\",\n",
       "                    \"value\": 847,\n",
       "                    \"textStyle\": {\n",
       "                        \"normal\": {\n",
       "                            \"color\": \"rgb(76,136,20)\"\n",
       "                        }\n",
       "                    }\n",
       "                },\n",
       "                {\n",
       "                    \"name\": \"Lena Dunham\",\n",
       "                    \"value\": 582,\n",
       "                    \"textStyle\": {\n",
       "                        \"normal\": {\n",
       "                            \"color\": \"rgb(104,67,109)\"\n",
       "                        }\n",
       "                    }\n",
       "                },\n",
       "                {\n",
       "                    \"name\": \"Lewis Hamilton\",\n",
       "                    \"value\": 555,\n",
       "                    \"textStyle\": {\n",
       "                        \"normal\": {\n",
       "                            \"color\": \"rgb(12,63,35)\"\n",
       "                        }\n",
       "                    }\n",
       "                },\n",
       "                {\n",
       "                    \"name\": \"KXAN\",\n",
       "                    \"value\": 550,\n",
       "                    \"textStyle\": {\n",
       "                        \"normal\": {\n",
       "                            \"color\": \"rgb(44,103,147)\"\n",
       "                        }\n",
       "                    }\n",
       "                },\n",
       "                {\n",
       "                    \"name\": \"Mary Ellen Mark\",\n",
       "                    \"value\": 462,\n",
       "                    \"textStyle\": {\n",
       "                        \"normal\": {\n",
       "                            \"color\": \"rgb(15,25,118)\"\n",
       "                        }\n",
       "                    }\n",
       "                },\n",
       "                {\n",
       "                    \"name\": \"Farrah Abraham\",\n",
       "                    \"value\": 366,\n",
       "                    \"textStyle\": {\n",
       "                        \"normal\": {\n",
       "                            \"color\": \"rgb(97,99,7)\"\n",
       "                        }\n",
       "                    }\n",
       "                },\n",
       "                {\n",
       "                    \"name\": \"Rita Ora\",\n",
       "                    \"value\": 360,\n",
       "                    \"textStyle\": {\n",
       "                        \"normal\": {\n",
       "                            \"color\": \"rgb(106,52,13)\"\n",
       "                        }\n",
       "                    }\n",
       "                },\n",
       "                {\n",
       "                    \"name\": \"Serena Williams\",\n",
       "                    \"value\": 282,\n",
       "                    \"textStyle\": {\n",
       "                        \"normal\": {\n",
       "                            \"color\": \"rgb(1,52,56)\"\n",
       "                        }\n",
       "                    }\n",
       "                },\n",
       "                {\n",
       "                    \"name\": \"NCAA baseball tournament\",\n",
       "                    \"value\": 273,\n",
       "                    \"textStyle\": {\n",
       "                        \"normal\": {\n",
       "                            \"color\": \"rgb(106,157,40)\"\n",
       "                        }\n",
       "                    }\n",
       "                },\n",
       "                {\n",
       "                    \"name\": \"Point Break\",\n",
       "                    \"value\": 265,\n",
       "                    \"textStyle\": {\n",
       "                        \"normal\": {\n",
       "                            \"color\": \"rgb(144,69,34)\"\n",
       "                        }\n",
       "                    }\n",
       "                }\n",
       "            ]\n",
       "        }\n",
       "    ],\n",
       "    \"legend\": [\n",
       "        {\n",
       "            \"data\": [],\n",
       "            \"selected\": {},\n",
       "            \"show\": true\n",
       "        }\n",
       "    ],\n",
       "    \"tooltip\": {\n",
       "        \"show\": true,\n",
       "        \"trigger\": \"item\",\n",
       "        \"triggerOn\": \"mousemove|click\",\n",
       "        \"axisPointer\": {\n",
       "            \"type\": \"line\"\n",
       "        },\n",
       "        \"textStyle\": {\n",
       "            \"fontSize\": 14\n",
       "        },\n",
       "        \"borderWidth\": 0\n",
       "    },\n",
       "    \"title\": {\n",
       "        \"text\": \"Wordcloud\"\n",
       "    },\n",
       "    \"toolbox\": {\n",
       "        \"show\": true,\n",
       "        \"orient\": \"horizontal\",\n",
       "        \"itemSize\": 15,\n",
       "        \"itemGap\": 10,\n",
       "        \"left\": \"80%\",\n",
       "        \"feature\": {\n",
       "            \"saveAsImage\": {\n",
       "                \"show\": true,\n",
       "                \"title\": \"save as image\",\n",
       "                \"type\": \"png\"\n",
       "            },\n",
       "            \"restore\": {\n",
       "                \"show\": true,\n",
       "                \"title\": \"restore\"\n",
       "            },\n",
       "            \"dataView\": {\n",
       "                \"show\": true,\n",
       "                \"title\": \"data view\",\n",
       "                \"readOnly\": false\n",
       "            },\n",
       "            \"dataZoom\": {\n",
       "                \"show\": true,\n",
       "                \"title\": {\n",
       "                    \"zoom\": \"data zoom\",\n",
       "                    \"back\": \"data zoom restore\"\n",
       "                }\n",
       "            }\n",
       "        }\n",
       "    }\n",
       "};\n",
       "        chart_0cfcb3ee33454c8c96eea416c62c89a4.setOption(option_0cfcb3ee33454c8c96eea416c62c89a4);\n",
       "    });\n",
       "</script>\n"
      ],
      "text/plain": [
       "<pyecharts.render.display.HTML at 0x1168391d0>"
      ]
     },
     "execution_count": 39,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "new_df.pdchart.wordCloud(label='name', value='num').render_notebook()"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "#### 时序图 - timeline"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 42,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>year</th>\n",
       "      <th>size</th>\n",
       "      <th>sum</th>\n",
       "      <th>type</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>2001年</td>\n",
       "      <td>490</td>\n",
       "      <td>190</td>\n",
       "      <td>firefox</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>2002年</td>\n",
       "      <td>250</td>\n",
       "      <td>350</td>\n",
       "      <td>firefox</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>2003年</td>\n",
       "      <td>271</td>\n",
       "      <td>278</td>\n",
       "      <td>firefox</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>2004年</td>\n",
       "      <td>650</td>\n",
       "      <td>450</td>\n",
       "      <td>firefox</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>2001年</td>\n",
       "      <td>190</td>\n",
       "      <td>290</td>\n",
       "      <td>safari</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "    year  size  sum     type\n",
       "0  2001年   490  190  firefox\n",
       "1  2002年   250  350  firefox\n",
       "2  2003年   271  278  firefox\n",
       "3  2004年   650  450  firefox\n",
       "4  2001年   190  290   safari"
      ]
     },
     "execution_count": 42,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# 加载新的测试数据集\n",
    "mdf = pd.DataFrame({\n",
    "    'year': [str(i) + '年' for i in\n",
    "             [2001, 2002, 2003, 2004, 2001, 2002, 2003, 2004, 2001, 2002, 2003, 2004, 2001, 2002, 2003, 2004]],\n",
    "    'size': [490, 250, 271, 650, 190, 250, 289, 600, 290, 250, 181, 208, 190, 250, 291, 390],\n",
    "    'sum': [190, 350, 278, 450, 290, 290, 289, 600, 390, 150, 181, 258, 290, 550, 391, 280],\n",
    "    'type': ['firefox', 'firefox', 'firefox', 'firefox', 'safari', 'safari', 'safari', 'safari', 'chrome', 'chrome',\n",
    "             'chrome', 'chrome', 'edge', 'edge', 'edge', 'edge']\n",
    "})\n",
    "\n",
    "mdf.head(5)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 43,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<script>\n",
       "    require.config({\n",
       "        paths: {\n",
       "            'echarts':'https://assets.pyecharts.org/assets/echarts.min'\n",
       "        }\n",
       "    });\n",
       "</script>\n",
       "\n",
       "    <div id=\"af05f6e5a94743b79d214ccd7748c9ed\" style=\"width:900px; height:500px;\"></div>\n",
       "\n",
       "\n",
       "<script>\n",
       "    require(['echarts'], function(echarts) {\n",
       "        var chart_af05f6e5a94743b79d214ccd7748c9ed = echarts.init(\n",
       "            document.getElementById('af05f6e5a94743b79d214ccd7748c9ed'), 'white', {renderer: 'canvas'});\n",
       "        var option_af05f6e5a94743b79d214ccd7748c9ed = {\n",
       "    \"baseOption\": {\n",
       "        \"series\": [\n",
       "            {\n",
       "                \"type\": \"bar\",\n",
       "                \"name\": \"size\",\n",
       "                \"data\": [\n",
       "                    650,\n",
       "                    600,\n",
       "                    208,\n",
       "                    390\n",
       "                ],\n",
       "                \"barCategoryGap\": \"20%\",\n",
       "                \"label\": {\n",
       "                    \"show\": true,\n",
       "                    \"position\": \"top\",\n",
       "                    \"margin\": 8,\n",
       "                    \"fontSize\": 12\n",
       "                }\n",
       "            },\n",
       "            {\n",
       "                \"type\": \"bar\",\n",
       "                \"name\": \"sum\",\n",
       "                \"data\": [\n",
       "                    450,\n",
       "                    600,\n",
       "                    258,\n",
       "                    280\n",
       "                ],\n",
       "                \"barCategoryGap\": \"20%\",\n",
       "                \"label\": {\n",
       "                    \"show\": true,\n",
       "                    \"position\": \"top\",\n",
       "                    \"margin\": 8,\n",
       "                    \"fontSize\": 12\n",
       "                }\n",
       "            }\n",
       "        ],\n",
       "        \"timeline\": {\n",
       "            \"axisType\": \"category\",\n",
       "            \"orient\": \"horizontal\",\n",
       "            \"autoPlay\": false,\n",
       "            \"loop\": true,\n",
       "            \"rewind\": false,\n",
       "            \"show\": true,\n",
       "            \"inverse\": false,\n",
       "            \"bottom\": \"-5px\",\n",
       "            \"data\": [\n",
       "                \"2001\\u5e74\",\n",
       "                \"2002\\u5e74\",\n",
       "                \"2003\\u5e74\",\n",
       "                \"2004\\u5e74\"\n",
       "            ]\n",
       "        },\n",
       "        \"xAxis\": [\n",
       "            {\n",
       "                \"show\": true,\n",
       "                \"scale\": false,\n",
       "                \"nameLocation\": \"end\",\n",
       "                \"nameGap\": 15,\n",
       "                \"gridIndex\": 0,\n",
       "                \"inverse\": false,\n",
       "                \"offset\": 0,\n",
       "                \"splitNumber\": 5,\n",
       "                \"minInterval\": 0,\n",
       "                \"splitLine\": {\n",
       "                    \"show\": false,\n",
       "                    \"lineStyle\": {\n",
       "                        \"width\": 1,\n",
       "                        \"opacity\": 1,\n",
       "                        \"curveness\": 0,\n",
       "                        \"type\": \"solid\"\n",
       "                    }\n",
       "                },\n",
       "                \"data\": [\n",
       "                    \"firefox\",\n",
       "                    \"safari\",\n",
       "                    \"chrome\",\n",
       "                    \"edge\"\n",
       "                ]\n",
       "            }\n",
       "        ],\n",
       "        \"yAxis\": [\n",
       "            {\n",
       "                \"show\": true,\n",
       "                \"scale\": false,\n",
       "                \"nameLocation\": \"end\",\n",
       "                \"nameGap\": 15,\n",
       "                \"gridIndex\": 0,\n",
       "                \"inverse\": false,\n",
       "                \"offset\": 0,\n",
       "                \"splitNumber\": 5,\n",
       "                \"minInterval\": 0,\n",
       "                \"splitLine\": {\n",
       "                    \"show\": false,\n",
       "                    \"lineStyle\": {\n",
       "                        \"width\": 1,\n",
       "                        \"opacity\": 1,\n",
       "                        \"curveness\": 0,\n",
       "                        \"type\": \"solid\"\n",
       "                    }\n",
       "                }\n",
       "            }\n",
       "        ]\n",
       "    },\n",
       "    \"options\": [\n",
       "        {\n",
       "            \"legend\": [\n",
       "                {\n",
       "                    \"data\": [\n",
       "                        \"size\",\n",
       "                        \"sum\"\n",
       "                    ],\n",
       "                    \"selected\": {\n",
       "                        \"size\": true,\n",
       "                        \"sum\": true\n",
       "                    },\n",
       "                    \"show\": true\n",
       "                }\n",
       "            ],\n",
       "            \"series\": [\n",
       "                {\n",
       "                    \"data\": [\n",
       "                        490,\n",
       "                        190,\n",
       "                        290,\n",
       "                        190\n",
       "                    ]\n",
       "                },\n",
       "                {\n",
       "                    \"data\": [\n",
       "                        190,\n",
       "                        290,\n",
       "                        390,\n",
       "                        290\n",
       "                    ]\n",
       "                }\n",
       "            ],\n",
       "            \"title\": {\n",
       "                \"text\": \"Bar\"\n",
       "            },\n",
       "            \"tooltip\": {\n",
       "                \"show\": true,\n",
       "                \"trigger\": \"item\",\n",
       "                \"triggerOn\": \"mousemove|click\",\n",
       "                \"axisPointer\": {\n",
       "                    \"type\": \"line\"\n",
       "                },\n",
       "                \"textStyle\": {\n",
       "                    \"fontSize\": 14\n",
       "                },\n",
       "                \"borderWidth\": 0\n",
       "            }\n",
       "        },\n",
       "        {\n",
       "            \"legend\": [\n",
       "                {\n",
       "                    \"data\": [\n",
       "                        \"size\",\n",
       "                        \"sum\"\n",
       "                    ],\n",
       "                    \"selected\": {\n",
       "                        \"size\": true,\n",
       "                        \"sum\": true\n",
       "                    },\n",
       "                    \"show\": true\n",
       "                }\n",
       "            ],\n",
       "            \"series\": [\n",
       "                {\n",
       "                    \"data\": [\n",
       "                        250,\n",
       "                        250,\n",
       "                        250,\n",
       "                        250\n",
       "                    ]\n",
       "                },\n",
       "                {\n",
       "                    \"data\": [\n",
       "                        350,\n",
       "                        290,\n",
       "                        150,\n",
       "                        550\n",
       "                    ]\n",
       "                }\n",
       "            ],\n",
       "            \"title\": {\n",
       "                \"text\": \"Bar\"\n",
       "            },\n",
       "            \"tooltip\": {\n",
       "                \"show\": true,\n",
       "                \"trigger\": \"item\",\n",
       "                \"triggerOn\": \"mousemove|click\",\n",
       "                \"axisPointer\": {\n",
       "                    \"type\": \"line\"\n",
       "                },\n",
       "                \"textStyle\": {\n",
       "                    \"fontSize\": 14\n",
       "                },\n",
       "                \"borderWidth\": 0\n",
       "            }\n",
       "        },\n",
       "        {\n",
       "            \"legend\": [\n",
       "                {\n",
       "                    \"data\": [\n",
       "                        \"size\",\n",
       "                        \"sum\"\n",
       "                    ],\n",
       "                    \"selected\": {\n",
       "                        \"size\": true,\n",
       "                        \"sum\": true\n",
       "                    },\n",
       "                    \"show\": true\n",
       "                }\n",
       "            ],\n",
       "            \"series\": [\n",
       "                {\n",
       "                    \"data\": [\n",
       "                        271,\n",
       "                        289,\n",
       "                        181,\n",
       "                        291\n",
       "                    ]\n",
       "                },\n",
       "                {\n",
       "                    \"data\": [\n",
       "                        278,\n",
       "                        289,\n",
       "                        181,\n",
       "                        391\n",
       "                    ]\n",
       "                }\n",
       "            ],\n",
       "            \"title\": {\n",
       "                \"text\": \"Bar\"\n",
       "            },\n",
       "            \"tooltip\": {\n",
       "                \"show\": true,\n",
       "                \"trigger\": \"item\",\n",
       "                \"triggerOn\": \"mousemove|click\",\n",
       "                \"axisPointer\": {\n",
       "                    \"type\": \"line\"\n",
       "                },\n",
       "                \"textStyle\": {\n",
       "                    \"fontSize\": 14\n",
       "                },\n",
       "                \"borderWidth\": 0\n",
       "            }\n",
       "        },\n",
       "        {\n",
       "            \"legend\": [\n",
       "                {\n",
       "                    \"data\": [\n",
       "                        \"size\",\n",
       "                        \"sum\"\n",
       "                    ],\n",
       "                    \"selected\": {\n",
       "                        \"size\": true,\n",
       "                        \"sum\": true\n",
       "                    },\n",
       "                    \"show\": true\n",
       "                }\n",
       "            ],\n",
       "            \"series\": [\n",
       "                {\n",
       "                    \"data\": [\n",
       "                        650,\n",
       "                        600,\n",
       "                        208,\n",
       "                        390\n",
       "                    ]\n",
       "                },\n",
       "                {\n",
       "                    \"data\": [\n",
       "                        450,\n",
       "                        600,\n",
       "                        258,\n",
       "                        280\n",
       "                    ]\n",
       "                }\n",
       "            ],\n",
       "            \"title\": {\n",
       "                \"text\": \"Bar\"\n",
       "            },\n",
       "            \"tooltip\": {\n",
       "                \"show\": true,\n",
       "                \"trigger\": \"item\",\n",
       "                \"triggerOn\": \"mousemove|click\",\n",
       "                \"axisPointer\": {\n",
       "                    \"type\": \"line\"\n",
       "                },\n",
       "                \"textStyle\": {\n",
       "                    \"fontSize\": 14\n",
       "                },\n",
       "                \"borderWidth\": 0\n",
       "            }\n",
       "        }\n",
       "    ]\n",
       "};\n",
       "        chart_af05f6e5a94743b79d214ccd7748c9ed.setOption(option_af05f6e5a94743b79d214ccd7748c9ed);\n",
       "    });\n",
       "</script>\n"
      ],
      "text/plain": [
       "<pyecharts.render.display.HTML at 0x1143fe240>"
      ]
     },
     "execution_count": 43,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "mdf.pdchart.bar(x='type', y=['size', 'sum'], timeline='year').render_notebook()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 44,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<script>\n",
       "    require.config({\n",
       "        paths: {\n",
       "            'echarts':'https://assets.pyecharts.org/assets/echarts.min'\n",
       "        }\n",
       "    });\n",
       "</script>\n",
       "\n",
       "    <div id=\"cdc42957c5784f4eb15869292bca4af4\" style=\"width:900px; height:500px;\"></div>\n",
       "\n",
       "\n",
       "<script>\n",
       "    require(['echarts'], function(echarts) {\n",
       "        var chart_cdc42957c5784f4eb15869292bca4af4 = echarts.init(\n",
       "            document.getElementById('cdc42957c5784f4eb15869292bca4af4'), 'white', {renderer: 'canvas'});\n",
       "        var option_cdc42957c5784f4eb15869292bca4af4 = {\n",
       "    \"baseOption\": {\n",
       "        \"series\": [\n",
       "            {\n",
       "                \"type\": \"line\",\n",
       "                \"name\": \"size\",\n",
       "                \"symbolSize\": 4,\n",
       "                \"showSymbol\": true,\n",
       "                \"smooth\": false,\n",
       "                \"step\": false,\n",
       "                \"data\": [\n",
       "                    [\n",
       "                        \"firefox\",\n",
       "                        650\n",
       "                    ],\n",
       "                    [\n",
       "                        \"safari\",\n",
       "                        600\n",
       "                    ],\n",
       "                    [\n",
       "                        \"chrome\",\n",
       "                        208\n",
       "                    ],\n",
       "                    [\n",
       "                        \"edge\",\n",
       "                        390\n",
       "                    ]\n",
       "                ],\n",
       "                \"label\": {\n",
       "                    \"show\": true,\n",
       "                    \"position\": \"top\",\n",
       "                    \"margin\": 8,\n",
       "                    \"fontSize\": 12\n",
       "                },\n",
       "                \"lineStyle\": {\n",
       "                    \"width\": 1,\n",
       "                    \"opacity\": 1,\n",
       "                    \"curveness\": 0,\n",
       "                    \"type\": \"solid\"\n",
       "                },\n",
       "                \"areaStyle\": {\n",
       "                    \"opacity\": 0\n",
       "                }\n",
       "            },\n",
       "            {\n",
       "                \"type\": \"line\",\n",
       "                \"name\": \"sum\",\n",
       "                \"symbolSize\": 4,\n",
       "                \"showSymbol\": true,\n",
       "                \"smooth\": false,\n",
       "                \"step\": false,\n",
       "                \"data\": [\n",
       "                    [\n",
       "                        \"firefox\",\n",
       "                        450\n",
       "                    ],\n",
       "                    [\n",
       "                        \"safari\",\n",
       "                        600\n",
       "                    ],\n",
       "                    [\n",
       "                        \"chrome\",\n",
       "                        258\n",
       "                    ],\n",
       "                    [\n",
       "                        \"edge\",\n",
       "                        280\n",
       "                    ]\n",
       "                ],\n",
       "                \"label\": {\n",
       "                    \"show\": true,\n",
       "                    \"position\": \"top\",\n",
       "                    \"margin\": 8,\n",
       "                    \"fontSize\": 12\n",
       "                },\n",
       "                \"lineStyle\": {\n",
       "                    \"width\": 1,\n",
       "                    \"opacity\": 1,\n",
       "                    \"curveness\": 0,\n",
       "                    \"type\": \"solid\"\n",
       "                },\n",
       "                \"areaStyle\": {\n",
       "                    \"opacity\": 0\n",
       "                }\n",
       "            }\n",
       "        ],\n",
       "        \"timeline\": {\n",
       "            \"axisType\": \"category\",\n",
       "            \"orient\": \"horizontal\",\n",
       "            \"autoPlay\": false,\n",
       "            \"loop\": true,\n",
       "            \"rewind\": false,\n",
       "            \"show\": true,\n",
       "            \"inverse\": false,\n",
       "            \"bottom\": \"-5px\",\n",
       "            \"data\": [\n",
       "                \"2001\\u5e74\",\n",
       "                \"2002\\u5e74\",\n",
       "                \"2003\\u5e74\",\n",
       "                \"2004\\u5e74\"\n",
       "            ]\n",
       "        },\n",
       "        \"xAxis\": [\n",
       "            {\n",
       "                \"show\": true,\n",
       "                \"scale\": false,\n",
       "                \"nameLocation\": \"end\",\n",
       "                \"nameGap\": 15,\n",
       "                \"gridIndex\": 0,\n",
       "                \"inverse\": false,\n",
       "                \"offset\": 0,\n",
       "                \"splitNumber\": 5,\n",
       "                \"minInterval\": 0,\n",
       "                \"splitLine\": {\n",
       "                    \"show\": false,\n",
       "                    \"lineStyle\": {\n",
       "                        \"width\": 1,\n",
       "                        \"opacity\": 1,\n",
       "                        \"curveness\": 0,\n",
       "                        \"type\": \"solid\"\n",
       "                    }\n",
       "                },\n",
       "                \"data\": [\n",
       "                    \"firefox\",\n",
       "                    \"safari\",\n",
       "                    \"chrome\",\n",
       "                    \"edge\"\n",
       "                ]\n",
       "            }\n",
       "        ],\n",
       "        \"yAxis\": [\n",
       "            {\n",
       "                \"show\": true,\n",
       "                \"scale\": false,\n",
       "                \"nameLocation\": \"end\",\n",
       "                \"nameGap\": 15,\n",
       "                \"gridIndex\": 0,\n",
       "                \"inverse\": false,\n",
       "                \"offset\": 0,\n",
       "                \"splitNumber\": 5,\n",
       "                \"minInterval\": 0,\n",
       "                \"splitLine\": {\n",
       "                    \"show\": false,\n",
       "                    \"lineStyle\": {\n",
       "                        \"width\": 1,\n",
       "                        \"opacity\": 1,\n",
       "                        \"curveness\": 0,\n",
       "                        \"type\": \"solid\"\n",
       "                    }\n",
       "                }\n",
       "            }\n",
       "        ]\n",
       "    },\n",
       "    \"options\": [\n",
       "        {\n",
       "            \"legend\": [\n",
       "                {\n",
       "                    \"data\": [\n",
       "                        \"size\",\n",
       "                        \"sum\"\n",
       "                    ],\n",
       "                    \"selected\": {\n",
       "                        \"size\": true,\n",
       "                        \"sum\": true\n",
       "                    },\n",
       "                    \"show\": true\n",
       "                }\n",
       "            ],\n",
       "            \"series\": [\n",
       "                {\n",
       "                    \"data\": [\n",
       "                        [\n",
       "                            \"firefox\",\n",
       "                            490\n",
       "                        ],\n",
       "                        [\n",
       "                            \"safari\",\n",
       "                            190\n",
       "                        ],\n",
       "                        [\n",
       "                            \"chrome\",\n",
       "                            290\n",
       "                        ],\n",
       "                        [\n",
       "                            \"edge\",\n",
       "                            190\n",
       "                        ]\n",
       "                    ]\n",
       "                },\n",
       "                {\n",
       "                    \"data\": [\n",
       "                        [\n",
       "                            \"firefox\",\n",
       "                            190\n",
       "                        ],\n",
       "                        [\n",
       "                            \"safari\",\n",
       "                            290\n",
       "                        ],\n",
       "                        [\n",
       "                            \"chrome\",\n",
       "                            390\n",
       "                        ],\n",
       "                        [\n",
       "                            \"edge\",\n",
       "                            290\n",
       "                        ]\n",
       "                    ]\n",
       "                }\n",
       "            ],\n",
       "            \"title\": {\n",
       "                \"text\": \"Line\"\n",
       "            },\n",
       "            \"tooltip\": {\n",
       "                \"show\": true,\n",
       "                \"trigger\": \"item\",\n",
       "                \"triggerOn\": \"mousemove|click\",\n",
       "                \"axisPointer\": {\n",
       "                    \"type\": \"line\"\n",
       "                },\n",
       "                \"textStyle\": {\n",
       "                    \"fontSize\": 14\n",
       "                },\n",
       "                \"borderWidth\": 0\n",
       "            }\n",
       "        },\n",
       "        {\n",
       "            \"legend\": [\n",
       "                {\n",
       "                    \"data\": [\n",
       "                        \"size\",\n",
       "                        \"sum\"\n",
       "                    ],\n",
       "                    \"selected\": {\n",
       "                        \"size\": true,\n",
       "                        \"sum\": true\n",
       "                    },\n",
       "                    \"show\": true\n",
       "                }\n",
       "            ],\n",
       "            \"series\": [\n",
       "                {\n",
       "                    \"data\": [\n",
       "                        [\n",
       "                            \"firefox\",\n",
       "                            250\n",
       "                        ],\n",
       "                        [\n",
       "                            \"safari\",\n",
       "                            250\n",
       "                        ],\n",
       "                        [\n",
       "                            \"chrome\",\n",
       "                            250\n",
       "                        ],\n",
       "                        [\n",
       "                            \"edge\",\n",
       "                            250\n",
       "                        ]\n",
       "                    ]\n",
       "                },\n",
       "                {\n",
       "                    \"data\": [\n",
       "                        [\n",
       "                            \"firefox\",\n",
       "                            350\n",
       "                        ],\n",
       "                        [\n",
       "                            \"safari\",\n",
       "                            290\n",
       "                        ],\n",
       "                        [\n",
       "                            \"chrome\",\n",
       "                            150\n",
       "                        ],\n",
       "                        [\n",
       "                            \"edge\",\n",
       "                            550\n",
       "                        ]\n",
       "                    ]\n",
       "                }\n",
       "            ],\n",
       "            \"title\": {\n",
       "                \"text\": \"Line\"\n",
       "            },\n",
       "            \"tooltip\": {\n",
       "                \"show\": true,\n",
       "                \"trigger\": \"item\",\n",
       "                \"triggerOn\": \"mousemove|click\",\n",
       "                \"axisPointer\": {\n",
       "                    \"type\": \"line\"\n",
       "                },\n",
       "                \"textStyle\": {\n",
       "                    \"fontSize\": 14\n",
       "                },\n",
       "                \"borderWidth\": 0\n",
       "            }\n",
       "        },\n",
       "        {\n",
       "            \"legend\": [\n",
       "                {\n",
       "                    \"data\": [\n",
       "                        \"size\",\n",
       "                        \"sum\"\n",
       "                    ],\n",
       "                    \"selected\": {\n",
       "                        \"size\": true,\n",
       "                        \"sum\": true\n",
       "                    },\n",
       "                    \"show\": true\n",
       "                }\n",
       "            ],\n",
       "            \"series\": [\n",
       "                {\n",
       "                    \"data\": [\n",
       "                        [\n",
       "                            \"firefox\",\n",
       "                            271\n",
       "                        ],\n",
       "                        [\n",
       "                            \"safari\",\n",
       "                            289\n",
       "                        ],\n",
       "                        [\n",
       "                            \"chrome\",\n",
       "                            181\n",
       "                        ],\n",
       "                        [\n",
       "                            \"edge\",\n",
       "                            291\n",
       "                        ]\n",
       "                    ]\n",
       "                },\n",
       "                {\n",
       "                    \"data\": [\n",
       "                        [\n",
       "                            \"firefox\",\n",
       "                            278\n",
       "                        ],\n",
       "                        [\n",
       "                            \"safari\",\n",
       "                            289\n",
       "                        ],\n",
       "                        [\n",
       "                            \"chrome\",\n",
       "                            181\n",
       "                        ],\n",
       "                        [\n",
       "                            \"edge\",\n",
       "                            391\n",
       "                        ]\n",
       "                    ]\n",
       "                }\n",
       "            ],\n",
       "            \"title\": {\n",
       "                \"text\": \"Line\"\n",
       "            },\n",
       "            \"tooltip\": {\n",
       "                \"show\": true,\n",
       "                \"trigger\": \"item\",\n",
       "                \"triggerOn\": \"mousemove|click\",\n",
       "                \"axisPointer\": {\n",
       "                    \"type\": \"line\"\n",
       "                },\n",
       "                \"textStyle\": {\n",
       "                    \"fontSize\": 14\n",
       "                },\n",
       "                \"borderWidth\": 0\n",
       "            }\n",
       "        },\n",
       "        {\n",
       "            \"legend\": [\n",
       "                {\n",
       "                    \"data\": [\n",
       "                        \"size\",\n",
       "                        \"sum\"\n",
       "                    ],\n",
       "                    \"selected\": {\n",
       "                        \"size\": true,\n",
       "                        \"sum\": true\n",
       "                    },\n",
       "                    \"show\": true\n",
       "                }\n",
       "            ],\n",
       "            \"series\": [\n",
       "                {\n",
       "                    \"data\": [\n",
       "                        [\n",
       "                            \"firefox\",\n",
       "                            650\n",
       "                        ],\n",
       "                        [\n",
       "                            \"safari\",\n",
       "                            600\n",
       "                        ],\n",
       "                        [\n",
       "                            \"chrome\",\n",
       "                            208\n",
       "                        ],\n",
       "                        [\n",
       "                            \"edge\",\n",
       "                            390\n",
       "                        ]\n",
       "                    ]\n",
       "                },\n",
       "                {\n",
       "                    \"data\": [\n",
       "                        [\n",
       "                            \"firefox\",\n",
       "                            450\n",
       "                        ],\n",
       "                        [\n",
       "                            \"safari\",\n",
       "                            600\n",
       "                        ],\n",
       "                        [\n",
       "                            \"chrome\",\n",
       "                            258\n",
       "                        ],\n",
       "                        [\n",
       "                            \"edge\",\n",
       "                            280\n",
       "                        ]\n",
       "                    ]\n",
       "                }\n",
       "            ],\n",
       "            \"title\": {\n",
       "                \"text\": \"Line\"\n",
       "            },\n",
       "            \"tooltip\": {\n",
       "                \"show\": true,\n",
       "                \"trigger\": \"item\",\n",
       "                \"triggerOn\": \"mousemove|click\",\n",
       "                \"axisPointer\": {\n",
       "                    \"type\": \"line\"\n",
       "                },\n",
       "                \"textStyle\": {\n",
       "                    \"fontSize\": 14\n",
       "                },\n",
       "                \"borderWidth\": 0\n",
       "            }\n",
       "        }\n",
       "    ]\n",
       "};\n",
       "        chart_cdc42957c5784f4eb15869292bca4af4.setOption(option_cdc42957c5784f4eb15869292bca4af4);\n",
       "    });\n",
       "</script>\n"
      ],
      "text/plain": [
       "<pyecharts.render.display.HTML at 0x1143fe828>"
      ]
     },
     "execution_count": 44,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "mdf.pdchart.line(x='type', y=['size', 'sum'], timeline='year').render_notebook()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 46,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<script>\n",
       "    require.config({\n",
       "        paths: {\n",
       "            'echarts':'https://assets.pyecharts.org/assets/echarts.min'\n",
       "        }\n",
       "    });\n",
       "</script>\n",
       "\n",
       "    <div id=\"9dfca9f6e94c4846beb65e43ab925266\" style=\"width:900px; height:500px;\"></div>\n",
       "\n",
       "\n",
       "<script>\n",
       "    require(['echarts'], function(echarts) {\n",
       "        var chart_9dfca9f6e94c4846beb65e43ab925266 = echarts.init(\n",
       "            document.getElementById('9dfca9f6e94c4846beb65e43ab925266'), 'white', {renderer: 'canvas'});\n",
       "        var option_9dfca9f6e94c4846beb65e43ab925266 = {\n",
       "    \"baseOption\": {\n",
       "        \"series\": [\n",
       "            {\n",
       "                \"type\": \"pie\",\n",
       "                \"clockwise\": true,\n",
       "                \"data\": [\n",
       "                    {\n",
       "                        \"name\": \"firefox\",\n",
       "                        \"value\": 650\n",
       "                    },\n",
       "                    {\n",
       "                        \"name\": \"safari\",\n",
       "                        \"value\": 600\n",
       "                    },\n",
       "                    {\n",
       "                        \"name\": \"chrome\",\n",
       "                        \"value\": 208\n",
       "                    },\n",
       "                    {\n",
       "                        \"name\": \"edge\",\n",
       "                        \"value\": 390\n",
       "                    }\n",
       "                ],\n",
       "                \"radius\": [\n",
       "                    \"30%\",\n",
       "                    \"55%\"\n",
       "                ],\n",
       "                \"center\": [\n",
       "                    \"50%\",\n",
       "                    \"50%\"\n",
       "                ],\n",
       "                \"roseType\": \"radius\",\n",
       "                \"label\": {\n",
       "                    \"show\": true,\n",
       "                    \"position\": \"top\",\n",
       "                    \"margin\": 8,\n",
       "                    \"fontSize\": 12\n",
       "                }\n",
       "            }\n",
       "        ],\n",
       "        \"timeline\": {\n",
       "            \"axisType\": \"category\",\n",
       "            \"orient\": \"horizontal\",\n",
       "            \"autoPlay\": false,\n",
       "            \"loop\": true,\n",
       "            \"rewind\": false,\n",
       "            \"show\": true,\n",
       "            \"inverse\": false,\n",
       "            \"bottom\": \"-5px\",\n",
       "            \"data\": [\n",
       "                \"2001\\u5e74\",\n",
       "                \"2002\\u5e74\",\n",
       "                \"2003\\u5e74\",\n",
       "                \"2004\\u5e74\"\n",
       "            ]\n",
       "        }\n",
       "    },\n",
       "    \"options\": [\n",
       "        {\n",
       "            \"legend\": [\n",
       "                {\n",
       "                    \"data\": [\n",
       "                        \"firefox\",\n",
       "                        \"safari\",\n",
       "                        \"chrome\",\n",
       "                        \"edge\"\n",
       "                    ],\n",
       "                    \"selected\": {},\n",
       "                    \"show\": true\n",
       "                }\n",
       "            ],\n",
       "            \"series\": [\n",
       "                {\n",
       "                    \"data\": [\n",
       "                        {\n",
       "                            \"name\": \"firefox\",\n",
       "                            \"value\": 490\n",
       "                        },\n",
       "                        {\n",
       "                            \"name\": \"safari\",\n",
       "                            \"value\": 190\n",
       "                        },\n",
       "                        {\n",
       "                            \"name\": \"chrome\",\n",
       "                            \"value\": 290\n",
       "                        },\n",
       "                        {\n",
       "                            \"name\": \"edge\",\n",
       "                            \"value\": 190\n",
       "                        }\n",
       "                    ]\n",
       "                }\n",
       "            ],\n",
       "            \"title\": {\n",
       "                \"text\": \"Pie\"\n",
       "            },\n",
       "            \"tooltip\": {\n",
       "                \"show\": true,\n",
       "                \"trigger\": \"item\",\n",
       "                \"triggerOn\": \"mousemove|click\",\n",
       "                \"axisPointer\": {\n",
       "                    \"type\": \"line\"\n",
       "                },\n",
       "                \"textStyle\": {\n",
       "                    \"fontSize\": 14\n",
       "                },\n",
       "                \"borderWidth\": 0\n",
       "            }\n",
       "        },\n",
       "        {\n",
       "            \"legend\": [\n",
       "                {\n",
       "                    \"data\": [\n",
       "                        \"firefox\",\n",
       "                        \"safari\",\n",
       "                        \"chrome\",\n",
       "                        \"edge\"\n",
       "                    ],\n",
       "                    \"selected\": {},\n",
       "                    \"show\": true\n",
       "                }\n",
       "            ],\n",
       "            \"series\": [\n",
       "                {\n",
       "                    \"data\": [\n",
       "                        {\n",
       "                            \"name\": \"firefox\",\n",
       "                            \"value\": 250\n",
       "                        },\n",
       "                        {\n",
       "                            \"name\": \"safari\",\n",
       "                            \"value\": 250\n",
       "                        },\n",
       "                        {\n",
       "                            \"name\": \"chrome\",\n",
       "                            \"value\": 250\n",
       "                        },\n",
       "                        {\n",
       "                            \"name\": \"edge\",\n",
       "                            \"value\": 250\n",
       "                        }\n",
       "                    ]\n",
       "                }\n",
       "            ],\n",
       "            \"title\": {\n",
       "                \"text\": \"Pie\"\n",
       "            },\n",
       "            \"tooltip\": {\n",
       "                \"show\": true,\n",
       "                \"trigger\": \"item\",\n",
       "                \"triggerOn\": \"mousemove|click\",\n",
       "                \"axisPointer\": {\n",
       "                    \"type\": \"line\"\n",
       "                },\n",
       "                \"textStyle\": {\n",
       "                    \"fontSize\": 14\n",
       "                },\n",
       "                \"borderWidth\": 0\n",
       "            }\n",
       "        },\n",
       "        {\n",
       "            \"legend\": [\n",
       "                {\n",
       "                    \"data\": [\n",
       "                        \"firefox\",\n",
       "                        \"safari\",\n",
       "                        \"chrome\",\n",
       "                        \"edge\"\n",
       "                    ],\n",
       "                    \"selected\": {},\n",
       "                    \"show\": true\n",
       "                }\n",
       "            ],\n",
       "            \"series\": [\n",
       "                {\n",
       "                    \"data\": [\n",
       "                        {\n",
       "                            \"name\": \"firefox\",\n",
       "                            \"value\": 271\n",
       "                        },\n",
       "                        {\n",
       "                            \"name\": \"safari\",\n",
       "                            \"value\": 289\n",
       "                        },\n",
       "                        {\n",
       "                            \"name\": \"chrome\",\n",
       "                            \"value\": 181\n",
       "                        },\n",
       "                        {\n",
       "                            \"name\": \"edge\",\n",
       "                            \"value\": 291\n",
       "                        }\n",
       "                    ]\n",
       "                }\n",
       "            ],\n",
       "            \"title\": {\n",
       "                \"text\": \"Pie\"\n",
       "            },\n",
       "            \"tooltip\": {\n",
       "                \"show\": true,\n",
       "                \"trigger\": \"item\",\n",
       "                \"triggerOn\": \"mousemove|click\",\n",
       "                \"axisPointer\": {\n",
       "                    \"type\": \"line\"\n",
       "                },\n",
       "                \"textStyle\": {\n",
       "                    \"fontSize\": 14\n",
       "                },\n",
       "                \"borderWidth\": 0\n",
       "            }\n",
       "        },\n",
       "        {\n",
       "            \"legend\": [\n",
       "                {\n",
       "                    \"data\": [\n",
       "                        \"firefox\",\n",
       "                        \"safari\",\n",
       "                        \"chrome\",\n",
       "                        \"edge\"\n",
       "                    ],\n",
       "                    \"selected\": {},\n",
       "                    \"show\": true\n",
       "                }\n",
       "            ],\n",
       "            \"series\": [\n",
       "                {\n",
       "                    \"data\": [\n",
       "                        {\n",
       "                            \"name\": \"firefox\",\n",
       "                            \"value\": 650\n",
       "                        },\n",
       "                        {\n",
       "                            \"name\": \"safari\",\n",
       "                            \"value\": 600\n",
       "                        },\n",
       "                        {\n",
       "                            \"name\": \"chrome\",\n",
       "                            \"value\": 208\n",
       "                        },\n",
       "                        {\n",
       "                            \"name\": \"edge\",\n",
       "                            \"value\": 390\n",
       "                        }\n",
       "                    ]\n",
       "                }\n",
       "            ],\n",
       "            \"title\": {\n",
       "                \"text\": \"Pie\"\n",
       "            },\n",
       "            \"tooltip\": {\n",
       "                \"show\": true,\n",
       "                \"trigger\": \"item\",\n",
       "                \"triggerOn\": \"mousemove|click\",\n",
       "                \"axisPointer\": {\n",
       "                    \"type\": \"line\"\n",
       "                },\n",
       "                \"textStyle\": {\n",
       "                    \"fontSize\": 14\n",
       "                },\n",
       "                \"borderWidth\": 0\n",
       "            }\n",
       "        }\n",
       "    ]\n",
       "};\n",
       "        chart_9dfca9f6e94c4846beb65e43ab925266.setOption(option_9dfca9f6e94c4846beb65e43ab925266);\n",
       "    });\n",
       "</script>\n"
      ],
      "text/plain": [
       "<pyecharts.render.display.HTML at 0x116bda9e8>"
      ]
     },
     "execution_count": 46,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "mdf.pdchart.pie(label='type', value='size', timeline='year', \n",
    "                 val_opts={'rosetype': 'radius', 'radius': [\"30%\", \"55%\"]}).render_notebook()"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "#### 3D 图表 \n",
    "\n",
    "开发中......\n",
    "\n",
    "\n",
    "更多的图表后续会陆续支持起来，谢谢支持！"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.6.3"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
